Skip to content

Cancel a payment session

POST
/gateway/sessions/{session_id}/cancel/
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.

session_id
required
string

Prefixed public id of the payment session (e.g. ps_...).

Media typeapplication/json

Response serializer for payment session detail.

object
id
required
string
merchant_reference
required

Merchant-provided unique reference for idempotency

string
<= 200 characters
order_number
required

System-generated order number (PM-XXXXXX)

string
<= 10 characters
order_id
Merchant order ID

Merchant’s display-friendly order ID (separate from merchant_reference)

string
<= 100 characters
amount
required
string
currency
string
<= 3 characters
original
required
object
amount
required

Requested amount, as a decimal string at the requested currency’s precision.

string
currency
required

Requested ISO 4217 currency code.

string
rate
required

Exchange rate applied (1 original.currency = rate currency), six decimals. “1.000000” when no conversion.

string
description
string
<= 500 characters
items

Line items: [{name, quantity, unit_price, description}]

status
  • CREATED - Created
  • PENDING - Pending
  • PROCESSING - Processing
  • SUCCEEDED - Succeeded
  • FAILED - Failed
  • EXPIRED - Expired
  • CANCELED - Canceled
string
Allowed values: CREATED PENDING PROCESSING SUCCEEDED FAILED EXPIRED CANCELED
livemode
required
boolean
buyer
required
object
first_name
required
string
last_name
required
string
email
required
string
phone
required
string
metadata
return_url
One of:
string format: uri
<= 2048 characters
cancel_url
One of:
string format: uri
<= 2048 characters
webhook_url
One of:
string format: uri
<= 2048 characters
max_attempts
integer
<= 2147483647
checkout_url
required
string | null
locale
required

Language of the payment page: fr, en, or auto (the buyer’s browser).

string
Allowed values: auto fr en
expires_at
required
string format: date-time
completed_at
string | null format: date-time
created_at
required
string format: date-time
attempts
required
Array<object>

Serializer for payment attempts (read-only).

object
id
required
string
attempt_number
required
integer
<= 2147483647
status
  • INITIATED - Initiated
  • PROCESSING - Processing
  • SUCCEEDED - Succeeded
  • FAILED - Failed
  • ABANDONED - Abandoned
string
Allowed values: INITIATED PROCESSING SUCCEEDED FAILED ABANDONED
card_brand
required
string | null
card_last_four
required
string | null
failure_code
required

The acquirer’s decline code, as webhooks carry it; None unless the attempt failed.

string | null
failure_message
required

The acquirer’s decline reason, as webhooks carry it; None unless the attempt failed.

string | null
fee_amount
required
string | null
net_amount
required
string | null
created_at
required
string format: date-time
refunds
required

Every refund of this session, oldest first.

Array<object>

A refund.

object
id
required

Refund id (re_…).

string
session_id
required

The refunded payment session (ps_…).

string
merchant_reference
required

The session’s merchant_reference.

string
amount
required

Refunded amount, as a decimal string.

string
currency
required

ISO 4217 currency of amount.

string
refund_type
  • FULL - Full
  • PARTIAL - Partial
string
Allowed values: FULL PARTIAL
status
required

PENDING while the refund is in progress, SUCCEEDED once the money is returned, FAILED if it was not.

string
Allowed values: PENDING SUCCEEDED FAILED
reason
Refund reason
string
processor_message
required

Why the refund is pending or failed, when known. Informational; may change.

string | null
created_at
required
string format: date-time
completed_at
required

When the refund reached SUCCEEDED or FAILED.

string | null
Example
{
"status": "CREATED",
"locale": "auto",
"attempts": [
{
"status": "INITIATED"
}
],
"refunds": [
{
"refund_type": "FULL",
"status": "PENDING"
}
]
}

Missing, malformed, expired, or revoked API key.

Media typeapplication/problem+json

RFC 9457 problem detail body (application/problem+json).

object
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example"
}

The payment session does not exist for this merchant account.

Media typeapplication/problem+json

RFC 9457 problem detail body (application/problem+json).

object
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example"
}

The request conflicts with an earlier one; the type says how.

Media typeapplication/problem+json

Problem detail of a 409.

object
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
existing_session_id

On a conflict from session creation: the session that already uses this merchant_reference.

string
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).

Media typeapplication/problem+json

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
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
errors
Array<object>

A single field-level validation error inside a problem+json body.

object
field
required

Name of the field that failed validation.

string
code
required

Machine-readable error code, e.g. ‘required’.

string
message
required

Human-readable description of the failure.

string
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.

Media typeapplication/problem+json

RFC 9457 problem detail body (application/problem+json).

object
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example"
}

Unexpected error; nothing was changed. Safe to retry with backoff.

Media typeapplication/problem+json

RFC 9457 problem detail body (application/problem+json).

object
type
required

URI identifying the error type.

string format: uri
title
required

Short, human-readable summary of the error type.

string
status
required

HTTP status code.

integer
detail
required

Human-readable explanation specific to this occurrence.

string
Examplegenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example"
}