Retrieve a charge refund
Retrieve a specific refund for a charge. Returns complete information about the refund including its status, amount, and transaction details.
Request Parametersโ
Required - 2 fieldsRequired Parameters
`id`STRING(required)
The charge ID that the refund belongs to. Must be a valid charge ID from your account.
`refund_id`STRING(required)
The refund ID to retrieve. Must be a valid refund ID associated with the specified charge.
Responsesโ
200
Successful retrievalReturns complete refund object with all fields.
Response includes:
id- Refund IDstatus- pending, closed, or failedamount- Refund amount in smallest currency unitcurrency- Currency codecharge- Associated charge IDtransaction- Associated transaction IDcreated_at- Refund creation timestampmetadata- Custom metadata (if set)
400
Bad requestInvalid parameters provided.
Common causes:
- Invalid charge ID format
- Invalid refund ID format
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 or refund ID does not exist.
Common causes:
- Incorrect charge ID
- Incorrect refund ID
- Refund does not belong to the specified charge
- Resource from different account
- Using test key for live resource (or vice versa)
5xx
Server errorServer-side error occurred. These are rare but should be handled gracefully.
How to handle:
- Retry the request with exponential backoff
- Check status.omise.co for service incidents
- See Error Handling for detailed guidance
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/charges/chrg_test_5xuy4w91xqz7d1w9u0t/refunds/rfnd_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = Omise::Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
refund = charge.refunds.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = omise.Charge.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t')
refund = charge.refunds.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const refund = await omise.charges.retrieveRefund(
'chrg_test_5xuy4w91xqz7d1w9u0t',
'rfnd_test_5xuy4w91xqz7d1w9u0t'
);
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$charge = OmiseCharge::retrieve('chrg_test_5xuy4w91xqz7d1w9u0t');
$refund = $charge->refunds()->retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Refund refund = client.charges()
.get("chrg_test_5xuy4w91xqz7d1w9u0t")
.refunds()
.get("rfnd_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var refund = await client.Charges.GetRefund(
"chrg_test_5xuy4w91xqz7d1w9u0t",
"rfnd_test_5xuy4w91xqz7d1w9u0t"
);
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
refund, _ := client.RetrieveChargeRefund(
"chrg_test_5xuy4w91xqz7d1w9u0t",
"rfnd_test_5xuy4w91xqz7d1w9u0t",
nil,
)
Error and result codesโ
Refund Status Valuesโ
| Status | Description | Next Steps |
|---|---|---|
pending | Refund is being processed | Wait for completion |
closed | Refund completed successfully | Funds returned to customer |
failed | Refund failed | Check failure reason |
Refund Object Fieldsโ
| Field | Type | Description |
|---|---|---|
id | string | Unique refund identifier |
object | string | Always "refund" |
livemode | boolean | Whether this is a live mode refund |
location | string | API path to this refund |
amount | integer | Refund amount in smallest currency unit |
currency | string | Three-letter ISO currency code |
charge | string | ID of the charge that was refunded |
transaction | string | ID of the associated transaction |
status | string | Current refund status |
created_at | string | ISO 8601 timestamp of creation |
metadata | object | Custom key-value pairs |
API Credentials
Try it outโ
Required - 2 fields
Your IP:
...Loading...