Skip to main content

Endpoint

POST https://buy.api.yabetoopay.com/v1/sessions

Authentication

Use your secret key in the Authorization header:
Authorization: Bearer YOUR_SECRET_KEY

Request Body

ParameterTypeRequiredDescription
totalnumberYesTotal amount in the smallest currency unit (e.g., 200000 = 200,000 XAF)
currencystringYesCurrency code (e.g., xaf, xof)
accountIdstringYesYour Yabetoo account ID
successUrlstringYesURL to redirect after successful payment
cancelUrlstringYesURL to redirect if payment is cancelled
itemsarrayNoList of items being purchased
metadataobjectNoCustom key-value data for your reference

Item structure

{
  "productId": "prod_12345",
  "productName": "HD Screen",
  "quantity": 1,
  "price": 200000
}

Example Request

curl -X POST https://buy.api.yabetoopay.com/v1/sessions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -d '{
    "total": 200000,
    "currency": "xaf",
    "accountId": "acct_xxxxxxxx",
    "successUrl": "https://your-site.com/checkout-success",
    "cancelUrl": "https://your-site.com/checkout-cancel",
    "metadata": { "orderId": "1234" },
    "items": [
      {
        "productId": "prod_12345",
        "quantity": 1,
        "price": 200000,
        "productName": "HD Screen"
      }
    ]
  }'

Response

200 OK

{
  "accountId": "acct_iNXIGeot1lqyhGI5eP7KL0LcWTCTgFLytfRa",
  "successUrl": "https://your-site.com/checkout-success",
  "cancelUrl": "https://your-site.com/checkout-cancel",
  "orderId": "ord_KowaIWyMlD25Lhb8MyY3GQyvN8nFaxTZ7ji7",
  "expiresAt": "2024-05-28T13:33:51.760+00:00",
  "id": "session_ajrw3pQUUZD8UI2eFkWyUgLxJ4kGuXCoaQeb",
  "createdAt": "2024-05-28T12:33:51.762+00:00",
  "updatedAt": "2024-05-28T12:33:51.762+00:00"
}

400 Bad Request

{
  "errors": [
    {
      "rule": "required",
      "field": "currency",
      "message": "required validation failed"
    }
  ]
}

401 Unauthorized

{
  "message": "Unauthorized"
}