Refund a payment session
const url = 'https://api.paymee.online/api/v1/gateway/sessions/example/refund/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"reason":"Customer requested a refund","refund_type":"FULL"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.paymee.online/api/v1/gateway/sessions/example/refund/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "reason": "Customer requested a refund", "refund_type": "FULL" }'Issue a full or partial refund against a succeeded payment session. For PARTIAL refunds, amount is required. The response is the refund: SUCCEEDED when the acquirer confirmed it, PENDING when it is completed manually (refund.succeeded / refund.failed follow). Send an Idempotency-Key to retry safely.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Prefixed public id of the payment session (e.g. ps_...).
Header Parameters
Section titled “Header Parameters”A unique value you generate per refund (e.g. a UUID v4), up to 255 characters. Repeating a request with the same key returns the refund it created (header Idempotent-Replayed: true) instead of refunding again; reusing it for a different request is a 409 idempotency-key-reuse. Keys do not expire.
Request Bodyrequired
Section titled “Request Bodyrequired”A refund request on the merchant API (sk_ keys).
reopen_invoice is a merchant-portal option (invoices are a portal feature), so the
API neither takes nor documents it.
object
FULL- FULLPARTIAL- PARTIAL
Required for partial refunds. A positive decimal string in the payment’s currency, e.g. “3.000”.
Examples
Full refund
{ "reason": "Customer requested a refund", "refund_type": "FULL"}Partial refund
{ "reason": "Damaged item", "refund_type": "PARTIAL", "amount": "3.000"}Responses
Section titled “Responses”A refund.
object
Refund id (re_…).
The refunded payment session (ps_…).
The session’s merchant_reference.
Refunded amount, as a decimal string.
ISO 4217 currency of amount.
FULL- FullPARTIAL- Partial
PENDING while the refund is in progress, SUCCEEDED once the money is returned, FAILED if it was not.
Why the refund is pending or failed, when known. Informational; may change.
When the refund reached SUCCEEDED or FAILED.
Example
{ "refund_type": "FULL", "status": "PENDING"}Malformed request: the body is not valid JSON, or a header is invalid.
RFC 9457 problem detail body (application/problem+json).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example"}Missing, malformed, expired, or revoked API key.
RFC 9457 problem detail body (application/problem+json).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example"}The payment session does not exist for this merchant account.
RFC 9457 problem detail body (application/problem+json).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example"}The request conflicts with an earlier one; the type says how.
Problem detail of a 409.
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
On a conflict from session creation: the session that already uses this merchant_reference.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "existing_session_id": "example"}A field failed validation (errors lists them), or a business rule refused the request (the type says which).
Problem detail of a 422: a per-field errors array when fields failed validation;
no errors when a business rule refused the request (the type says which).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
A single field-level validation error inside a problem+json body.
object
Name of the field that failed validation.
Machine-readable error code, e.g. ‘required’.
Human-readable description of the failure.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}Rate limit exceeded. Wait the number of seconds in the Retry-After header.
RFC 9457 problem detail body (application/problem+json).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example"}Unexpected error; nothing was changed. Safe to retry with backoff.
RFC 9457 problem detail body (application/problem+json).
object
URI identifying the error type.
Short, human-readable summary of the error type.
HTTP status code.
Human-readable explanation specific to this occurrence.
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example"}
