Create a payment session
const url = 'https://api.paymee.online/api/v1/gateway/sessions/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"amount":"example","currency":"example","merchant_reference":"example","description":"","order_id":"","first_name":"example","last_name":"example","email":"hello@example.com","phone":"","items":[{"additionalProperty":"example"}],"metadata":"example","return_url":"","cancel_url":"","webhook_url":"","max_attempts":5}'};
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/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "amount": "example", "currency": "example", "merchant_reference": "example", "description": "", "order_id": "", "first_name": "example", "last_name": "example", "email": "hello@example.com", "phone": "", "items": [ { "additionalProperty": "example" } ], "metadata": "example", "return_url": "", "cancel_url": "", "webhook_url": "", "max_attempts": 5 }'Create a payment session and its initial hosted checkout. The response includes a checkout_url to redirect the buyer to. Reusing the same merchant_reference returns the existing session (200) instead of creating a duplicate.
Currency. The buyer’s card is always charged, and you are always settled, in your account’s currency (TND). A request in TND is charged as sent. A request in another currency is converted at the exchange rate you configured for it (Settings → Currencies), rounded half-up to millimes; the response amount/currency are then the TND charge and original carries what you requested plus the rate applied. A request in a currency you have not configured a rate for is rejected with 422 and errors[].code = "currency_unsupported" on the currency field. The rate is frozen on the session at creation; later rate changes never alter an existing session, and an idempotent replay returns the original snapshot.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Input serializer for creating a payment session.
object
Amount as string with correct decimal places for currency
ISO 4217 code. Defaults to the account’s currency when omitted.
Merchant’s display-friendly order ID
Line items: [{name, quantity, unit_price, description}]
object
Input serializer for creating a payment session.
object
Amount as string with correct decimal places for currency
ISO 4217 code. Defaults to the account’s currency when omitted.
Merchant’s display-friendly order ID
Line items: [{name, quantity, unit_price, description}]
object
Input serializer for creating a payment session.
object
Amount as string with correct decimal places for currency
ISO 4217 code. Defaults to the account’s currency when omitted.
Merchant’s display-friendly order ID
Line items: [{name, quantity, unit_price, description}]
object
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
Redirect buyer here on payment failure or cancellation
Per-session webhook URL override
Serializer for payment attempts (read-only).
object
INITIATED- InitiatedPROCESSING- ProcessingSUCCEEDED- SucceededFAILED- FailedABANDONED- Abandoned
Example
{ "status": "CREATED", "attempts": [ { "status": "INITIATED" } ]}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
Redirect buyer here on payment failure or cancellation
Per-session webhook URL override
Serializer for payment attempts (read-only).
object
INITIATED- InitiatedPROCESSING- ProcessingSUCCEEDED- SucceededFAILED- FailedABANDONED- Abandoned
Example
{ "status": "CREATED", "attempts": [ { "status": "INITIATED" } ]}The request conflicts with the current state of the resource.
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"}One or more fields failed validation.
Problem detail with a per-field errors array (422 responses).
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" } ]}
