Retrieve a charge
Retrieve details of an existing charge. Returns complete information about the charge including its status, payment method, and transaction details.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`id`STRING(required)
The charge ID to retrieve. Must be a valid charge ID from your account.
Responsesโ
200
Successful retrievalReturns complete charge object with all fields.
Response includes:
status- pending, successful, failed, expired, or reversedamount- Charge amount in smallest currency unitpaid- Whether payment is completedauthorized- Whether charge is authorizedcard/source- Payment method detailsrefunds- List of refunds (if any)failure_code/failure_message- Error details if failed
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
404
Not foundCharge ID does not exist.
Common causes:
- Incorrect charge ID
- Charge from different account
- Using test key for live charge (or vice versa)
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/charges/chrg_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = Omise::Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = omise.Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const charge = await omise.charges.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$charge = OmiseCharge::retrieve('chrg_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Charge charge = client.charges().get("chrg_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var charge = await client.Charges.Get("chrg_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
charge, _ := client.RetrieveCharge("chrg_test_5xuy4w91xqz7d1w9u0t", nil)
Error and result codesโ
Charge Status Valuesโ
| Status | Description | Next Steps |
|---|---|---|
pending | Awaiting customer action | Wait for webhook or poll periodically |
successful | Payment completed | Fulfill order |
failed | Payment failed | Check failure_code and failure_message |
expired | Charge expired | Create new charge |
reversed | Pre-auth cancelled | No funds transferred |
Boolean Flagsโ
| Field | Description | Use Case |
|---|---|---|
paid | Payment completed | Check before fulfillment |
authorized | Funds authorized | Pre-auth status |
capturable | Can capture pre-auth | Check before capture |
refundable | Can create refund | Check before refund |
reversible | Can reverse pre-auth | Check before reverse |
Try it outโ
Required - 1 fields