Endpoint
POST https://buy.api.yabetoopay.com/v1/sessions
Authentication
Use your secret key in theAuthorization header:
Authorization: Bearer YOUR_SECRET_KEY
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
total | number | Yes | Total amount in the smallest currency unit (e.g., 200000 = 200,000 XAF) |
currency | string | Yes | Currency code (e.g., xaf, xof) |
accountId | string | Yes | Your Yabetoo account ID |
successUrl | string | Yes | URL to redirect after successful payment |
cancelUrl | string | Yes | URL to redirect if payment is cancelled |
items | array | Yes | List of items being purchased |
metadata | object | No | Custom key-value data for your reference |
Item structure
Every field of an item is required. Omitting one returns422 with
field: "items.*.<name>".
| Field | Type | Required | Description |
|---|---|---|---|
productId | string | Yes | Your product identifier |
productName | string | Yes | Label shown on the checkout page |
quantity | number | Yes | Number of units |
price | number | Yes | Unit price in the smallest currency unit |
{
"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"
}
]
}'
import Yabetoo from "@yabetoo/sdk-js";
const yabetoo = new Yabetoo("YOUR_SECRET_KEY");
const session = await yabetoo.sessions.create({
accountId: "acct_xxxxxxxx",
total: 200000,
currency: "xaf",
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",
},
],
});
from yabetoo import Yabetoo
from yabetoo.models.checkout import CreateCheckoutSession, CheckoutItem
yabetoo = Yabetoo("YOUR_SECRET_KEY")
items = [
CheckoutItem(
product_id="prod_12345",
product_name="HD Screen",
quantity=1,
price=200000
)
]
session = yabetoo.sessions.create(CreateCheckoutSession(
account_id="acct_xxxxxxxx",
total=200000,
currency="xaf",
success_url="https://your-site.com/checkout-success",
cancel_url="https://your-site.com/checkout-cancel",
items=items,
metadata={"orderId": "1234"}
))
<?php
require 'vendor/autoload.php';
use Yabetoo\Yabetoo;
$yabetoo = new Yabetoo("YOUR_SECRET_KEY");
$session = $yabetoo->sessions->create([
"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",
]
],
]);
import com.yabetoo.Yabetoo;
import com.yabetoo.YabetooConfig;
import com.yabetoo.model.Session;
import com.yabetoo.request.SessionCreateRequest;
import com.yabetoo.request.LineItem;
YabetooConfig config = new YabetooConfig()
.setApiKey("YOUR_SECRET_KEY");
Yabetoo yabetoo = new Yabetoo(config);
SessionCreateRequest request = SessionCreateRequest.builder()
.successUrl("https://your-site.com/checkout-success")
.cancelUrl("https://your-site.com/checkout-cancel")
.addLineItem(LineItem.builder()
.productId("prod_12345")
.quantity(1)
.price(200000)
.productName("HD Screen")
.build())
.currency("xaf")
.build();
Session session = yabetoo.sessions().create(request);
Response
201 Created
The session is returned as acheckout.session object, with snake_case field
names.
{
"id": "cs_QVdT8sK2mR7xLpZ0aB4nCjE1",
"object": "checkout.session",
"mode": "payment",
"status": "open",
"payment_status": "unpaid",
"url": "https://pay.yabetoo.com/c/cs_QVdT8sK2mR7xLpZ0aB4nCjE1",
"success_url": "https://your-site.com/checkout-success",
"cancel_url": "https://your-site.com/checkout-cancel",
"customer": null,
"customer_email": null,
"client_reference_id": null,
"amount_subtotal": 200000,
"amount_total": 200000,
"currency": "xaf",
"expires_at": 1786355639,
"created": 1786269239,
"livemode": false
}
| Field | Type | Description |
|---|---|---|
id | string | Session identifier, prefixed cs_ |
object | string | Always checkout.session |
mode | string | payment for this endpoint |
status | string | open, complete or expired |
payment_status | string | unpaid, paid or no_payment_required |
url | string | Hosted checkout page — redirect your customer here |
success_url / cancel_url | string | The URLs you supplied |
customer | string | null | Customer identifier, null if none was resolved |
customer_email | string | null | Customer email, null if not supplied |
client_reference_id | string | null | Your own reference, null if not supplied |
amount_subtotal / amount_total | number | Amounts in the smallest currency unit |
currency | string | Lowercase currency code |
expires_at | number | Expiry, Unix timestamp in seconds |
created | number | Creation, Unix timestamp in seconds |
livemode | boolean | false when the request used a test key |
This endpoint does not return
orderId, expiresAt, createdAt or
updatedAt, and the identifier is prefixed cs_ — not session_. Code that
reads those camelCase fields gets undefined, and code that filters on a
session_ prefix matches nothing. Read id, url and expires_at instead.422 Unprocessable Entity
Validation failures return422 — not 400. Each entry names the failing
field and the rule that rejected it; field uses items.*.<name> for a
field inside an item.
{
"errors": [
{
"message": "The productId field must be defined",
"rule": "required",
"field": "items.*.productId"
}
]
}
401 Unauthorized
A missingAuthorization header returns a plain-text body
(content-type: text/plain):
Unauthorized
{
"status": 401,
"path": "/v1/sessions",
"timestamp": "2026-08-09T09:54:11.157+00:00",
"code": "E_UNAUTHORIZED",
"message": "Unauthorized",
"detail": "You are not authorized to access this resource."
}