Retrieve a Refund
Retrieve detailed information about a specific refund including its status, amount, and associated transaction.
Request Parametersโ
Required - 2 fieldsRequired Parameters
`charge_id`STRING(required)
Charge ID that was refunded (path parameter).
`refund_id`STRING(required)
Refund ID to retrieve (path parameter). Format: rfnd_test_ or rfnd_live_ followed by alphanumeric string.
Responsesโ
200
Successful retrievalReturns the refund object with all details including status, amount, and timestamps.
Response includes:
object- The value "refund"id- Refund identifier (rfnd_*)livemode- Live or test modelocation- API path to the refund objectacquirer_reference_number- Reference number sent to card networksamount- Refund amount in smallest currency unitapproval_code- Reference number for approved transactionscapture- Capture referencecharge- Associated charge ID (expandable)currency- Three-letter ISO 4217 currency codefunding_amount- Amount in settlement currencyfunding_currency- Settlement currency codemerchant_name- Sub-merchant name (Payfac only)merchant_uid- Sub-merchant ID (Payfac only)metadata- Custom metadata attached to refundstatus- Current refund status (pending, successful, failed)terminal- Original point of sale locationtransaction- Associated transaction ID (expandable)voided- Whether refund was processed as a voidcreated_at- Refund creation timestamp (ISO 8601)
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
404
Not foundRefund or charge not found.
Common causes:
- Incorrect refund ID
- Incorrect charge ID
- Refund belongs to different charge
- Refund or charge belongs to different account
- ID typo or formatting error
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'
refund = Omise::Refund.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t', {
charge: 'chrg_test_5xuy4w91xqz7d1w9u0t'
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
refund = omise.Refund.retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t',
charge='chrg_test_5xuy4w91xqz7d1w9u0t'
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const refund = await omise.refunds.retrieve('chrg_test_5xuy4w91xqz7d1w9u0t', 'rfnd_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$refund = OmiseRefund::retrieve('rfnd_test_5xuy4w91xqz7d1w9u0t', [
'charge' => 'chrg_test_5xuy4w91xqz7d1w9u0t'
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Refund refund = client.refunds().get("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var refund = await client.Refunds.Get("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
refund, _ := client.GetRefund("chrg_test_5xuy4w91xqz7d1w9u0t", "rfnd_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Refund or charge not found | Check IDs are correct |
invalid_refund_id | Refund ID format invalid | Use valid rfnd_ format |
Refund Status Codesโ
| Status | Description |
|---|---|
pending | Refund being processed |
successful | Refund completed successfully |
failed | Refund failed (rare) |
API Credentials
Try it outโ
Required - 2 fields
Your IP:
...Loading...