Skip to content
Dashboard

Create a Payment Session

Create payment sessions from your backend. Your backend sends the order payload to HesabPay and receives a hosted checkout URL.

POST /api/v1/payment/create-session
Authorization: API-KEY your_api_key
Content-Type: application/json
{
"email": "[email protected]",
"user_id": "order-1001",
"items": [
{
"id": "item-1001",
"name": "Order #1001",
"price": 1200
}
],
"redirect_success_url": "https://merchant.example/success",
"redirect_failure_url": "https://merchant.example/failure"
}

user_id is an optional merchant-defined reference. Pass a unique order ID, payment ID, or other stable key from your system. If the payment succeeds, HesabPay returns the same value in the webhook so you can find and update the exact payment record on your side.

HesabPay does not generate or enforce uniqueness for user_id. Your system should provide a unique value of up to 50 characters for each payment you need to track.

FieldRequirement
itemsRequired and cannot be empty.
items[].idRequired; maximum 50 characters.
items[].nameRequired; maximum 500 characters.
items[].priceRequired; numeric amount with no more than two decimal places.
user_idOptional; maximum 50 characters.

The request does not have a quantity field. If an item has a quantity, calculate that line’s total in your backend and send the result as price.

{
"status_code": 10,
"success": true,
"message": "Payment session created successfully",
"url": "https://checkout.example/checkout/de53cfed-5d53-45d8-b240-42240e94565d?data=Z0FBQUFBQnFDVml5WUc0Wi1nYldyQ1N2bFFEX1p2d0VtTk4yWWd",
"expires_at": "2026-05-17T06:12:06.815381+00:00"
}