Skip to main content
POST
Create a refund

Authorizations

Authorization
string
header
required

Use the secret API key for the intended merchant and mode as the Bearer token. Sandbox keys start with api_test_sk_. Send the key only from your server environment.

Headers

Idempotency-Key
string
required

A unique key to ensure one effective operation is processed only once. If the same key and an equivalent operation-specific effective request identity have already completed successfully, the original response is returned. A different identity returns 409 idempotency_key_reused. Non-2xx responses are not cached, so callers may retry after errors. No fixed retention period is promised by this contract.

For one-shot requests, such as creating a payment from a checkout button, a random UUIDv4 is fine. For requests tied to a specific business operation, such as refunding an order, a deterministic key is preferred so retries collapse correctly across processes.

Maximum string length: 255

Body

application/json
payment_id
string
required

Unique opaque identifier for a payment (pay_ prefix + random alphanumeric suffix).

Pattern: ^pay_[A-Za-z0-9]{24}$
Example:

"pay_q7Mk2Np8Vr4Xt6Yz9Ab3Cd5E"

amount
integer<int64>
required

Refund amount in minor units, in the same currency as the original payment. Minor units follow that currency's ISO 4217 exponent, so 4999 is EUR 49.99 (exponent 2) but JPY 4999 (exponent 0). Do not assume two decimal places. Use the remaining refundable amount for a full refund.

Required range: x >= 1
Example:

1500

reason
string
required

Merchant-provided refund reason. The API accepts at most 50 characters.

Required string length: 1 - 50
Example:

"Full refund verification"

merchant_reference
integer<int64>

Optional merchant-side reconciliation reference. The value must contain exactly 10 decimal digits and does not provide idempotency by itself.

Required range: 1000000000 <= x <= 9999999999
Example:

1234567890

Response

Refund created and submitted. Inspect the returned status: continue retrieval through the parent Payment for PROCESSING, or handle the nested failure when the Refund is already FAILED.

A refund against a payment.

id
string
required

Unique opaque identifier for a refund (ref_ prefix + random alphanumeric suffix).

Pattern: ^ref_[A-Za-z0-9]{24}$
Example:

"ref_L9xQ4wE2rT8yU6iO3pA7sD1f"

payment_id
string
required

Unique opaque identifier for a payment (pay_ prefix + random alphanumeric suffix).

Pattern: ^pay_[A-Za-z0-9]{24}$
Example:

"pay_q7Mk2Np8Vr4Xt6Yz9Ab3Cd5E"

amount
integer<int64>
required

Refund amount in the currency's minor units, per its ISO 4217 exponent: 4999 is EUR 49.99 but JPY 4999.

Required range: x >= 1
Example:

1500

currency
string
required

Canonical uppercase three-letter ISO 4217 currency code. Responses always return the original currency the payment was created in; a provider response never replaces it.

Required string length: 3
Pattern: ^[A-Z]{3}$
Example:

"EUR"

reason
string
required

Merchant-provided refund reason stored with the refund.

Maximum string length: 50
Example:

"Full refund verification"

refund_type
enum<string>
required

Whether the refund covers the full original payment amount or only part of it.

Available options:
FULL,
PARTIAL
Example:

"FULL"

status
enum<string>
required

Current refund lifecycle status. Refunds normally move from PENDING to PROCESSING, then to SUCCEEDED or FAILED.

Available options:
PENDING,
PROCESSING,
SUCCEEDED,
FAILED
Example:

"PENDING"

created_at
integer<int64>
required

Unix timestamp when the refund was created.

Example:

1719795600

updated_at
integer<int64>
required

Unix timestamp when the refund was last updated.

Example:

1719795660

livemode
boolean
required

Always false for a Refund created in Sandbox.

Example:

false

merchant_reference
integer<int64> | null

Merchant-side reconciliation reference for this refund, if provided.

Required range: 1000000000 <= x <= 9999999999
Example:

1234567890

failure
object | null

Refund failure details when the refund reaches FAILED.

completed_at
integer<int64> | null

Unix timestamp when the refund reached a terminal status.

Example:

1719799200