Create a Payment Session
Create payment sessions from your backend. Your backend sends the order payload to HesabPay and receives a hosted checkout URL.
Endpoint
Section titled “Endpoint”POST /api/v1/payment/create-sessionAuthorization: API-KEY your_api_keyContent-Type: application/jsonRequest
Section titled “Request”{ "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.
Request field limits
Section titled “Request field limits”| Field | Requirement |
|---|---|
items | Required and cannot be empty. |
items[].id | Required; maximum 50 characters. |
items[].name | Required; maximum 500 characters. |
items[].price | Required; numeric amount with no more than two decimal places. |
user_id | Optional; 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.
Response
Section titled “Response”{ "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"}