Cancel a payment session
const url = 'https://api.paymee.online/api/v1/gateway/sessions/example/cancel/';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/cancel/ \ --header 'Authorization: Bearer <token>'Cancel a payment session that has not reached a terminal state.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Prefixed public id of the payment session (e.g. ps_...).
Responses
Section titled “Responses”Response serializer for payment session detail.
object
Merchant-provided unique reference for idempotency
System-generated order number (PM-XXXXXX)
Merchant’s display-friendly order ID (separate from merchant_reference)
object
Requested amount, as a decimal string at the requested currency’s precision.
Requested ISO 4217 currency code.
Exchange rate applied (1 original.currency = rate currency), six decimals. “1.000000” when no conversion.
Line items: [{name, quantity, unit_price, description}]
CREATED- CreatedPENDING- PendingPROCESSING- ProcessingSUCCEEDED- SucceededFAILED- FailedEXPIRED- ExpiredCANCELED- Canceled
object
Language of the payment page: fr, en, or auto (the buyer’s browser).
Serializer for payment attempts (read-only).
object
INITIATED- InitiatedPROCESSING- ProcessingSUCCEEDED- SucceededFAILED- FailedABANDONED- Abandoned
The acquirer’s decline code, as webhooks carry it; None unless the attempt failed.
The acquirer’s decline reason, as webhooks carry it; None unless the attempt failed.
Every refund of this session, oldest first.
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
{ "status": "CREATED", "locale": "auto", "attempts": [ { "status": "INITIATED" } ], "refunds": [ { "refund_type": "FULL", "status": "PENDING" } ]}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"}
