Skip to main content
POST
/
v1
/
checkouts
{
  "id": "cs_ci_123456789",
  "status": "created",
  "amount": 5000,
  "currency": "XOF",
  "user_phone": "+22507987654",
  "payment_id": "ORDER_123",
  "description": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "failure_reason": "<string>",
  "transaction_fee": 25
}

Create a Checkout Session

This endpoint allows you to create a new checkout session for processing payments.

Endpoint

  • Endpoint: POST /v1/checkouts
  • Description: Create a new checkout session.
  • Request Body:
    {
      "amount": 1000,
      "currency": "usd",
      "payment_method": "card",
      "success_url": "https://example.com/success",
      "cancel_url": "https://example.com/cancel"
    }
    
  • Response:
    {
      "id": "cs_test_123",
      "amount": 1000,
      "currency": "usd",
      "status": "pending",
      "created_at": "2024-01-01T12:00:00Z",
      "customer_id": "cus_456"
    }
    

Parameters

  • amount (integer, required): The total amount for the checkout session in the smallest currency unit (e.g., cents for USD).
  • currency (string, required): The currency code (e.g., “usd”).
  • payment_method (string, required): The payment method type (e.g., “card”).
  • success_url (string, required): The URL to redirect to upon successful payment.
  • cancel_url (string, required): The URL to redirect to if the payment is canceled.

Example Request

curl -X POST https://api.example.com/v1/checkouts \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "usd",
    "payment_method": "card",
    "success_url": "https://example.com/success",
    "cancel_url": "https://example.com/cancel"
  }'

Example Response

{
  "id": "cs_test_123",
  "amount": 1000,
  "currency": "usd",
  "status": "pending",
  "created_at": "2024-01-01T12:00:00Z",
  "customer_id": "cus_456"
}

Notes

  • Ensure that all required parameters are included in the request body.
  • The response includes the unique identifier of the newly created checkout session along with its details.

Errors

  • 400 Bad Request: Missing or invalid request parameters.
  • 401 Unauthorized: Invalid or missing API key.
  • 500 Internal Server Error: An error occurred on the server while processing the request.

See Also

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

idempotency-key
string
required

UUID

Maximum length: 1000

Body

application/json
amount
integer
required
Required range: x >= 100
Example:

5000

currency
enum<string>
required
Available options:
XOF
Example:

"XOF"

user_phone
string
required
Example:

"+22507987654"

description
string
Maximum length: 200
expires_in
integer
default:1800

TTL session en secondes (défaut: 1800)

Required range: 300 <= x <= 86400

Response

Session already exist

id
string
Example:

"cs_ci_123456789"

status
enum<string>
Available options:
created,
pending,
processing,
completed,
failed,
expired,
cancelled
Example:

"created"

amount
integer
Example:

5000

currency
string
Example:

"XOF"

user_phone
string
Example:

"+22507987654"

payment_id
string
Example:

"ORDER_123"

description
string
created_at
string<date-time>
expires_at
string<date-time>
completed_at
string<date-time> | null
failure_reason
string | null
transaction_fee
integer
Example:

25