Create a Session
Sessions should be created using your secret key as they should be created through your backend system to preserve the security.
When you create a session you specify the items for the session, the sum of all items value will be the total to be paid for the session. A session should have at least one item and it's unit_amount or total_amount should be greater than 0. If unit_amount is specified, the total value of the item will be calculated unit_amount*quantity.
An id is required when creating sessions. You should keep a reference of this id in your system for future reference and webhook handling.
API Documentation: Create Session
Request:
curl -i -X POST \
https://sandbox-api.pathly.io/checkout/sessions \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"id": "ec7e1848-dc80-4ab0-8827-dd7fc0737b43",
"currency": "USD",
"client_reference": "order-123-abc",
"success_url": "http://example.com",
"cancel_url": "http://example.com",
"expires_at": 2956656767,
"description": "string",
"items": [
{
"description": "string",
"unit_amount": 50000,
"quantity": 1
}
]
}'
Response:
When 3DS is enabled on your account, the response from this endpoint will always be a 202 with a message of “3DS Required”. In the response body, you will find the URL to which you should redirect your customer to complete the authentication:
{
"status": "pending",
"code": 202,
"data": {
"acs_url": "https://pathly.io/acs?sid=61cbcb99cf4598b…"
},
"message": "3DS Required"
}
If anything but a 202 is returned, it means there was a problem with creating the charge, and a description of the problem will be returned in the response body.