Checkout

Create Checkout Session

post

Create a checkout session with a product ID.

Header parameters
x-api-keystringRequired

Your API Keys

Example: bagel_test_64C70FE8526A48568D4EEA9D9164F508
Body
product_idstringRequired

The unique identifier of the product. You can get the product id in dashboard.

Example: prod_1964884901818347521
request_idstringOptional

When creating a checkout-session, you can optionally add a request_id parameter to track the payment. This parameter will be sent back to you in the response and in the webhook events. Use this parameter to track the payment or user in your system.

Example: requst_123456789
unitsstringOptional

The number of units for the order. Default value is 1.

Example: 1
success_urlstringOptional

The URL to which the user will be redirected after the checkout process is completed. You can pass a custom success_url for each checkout_session, this allows you to dynamically redirect users to custom pages after each payment (useful for directing users to their specific account resources after payment).

Example: https://www.yoursite.com/success_callback
Responses
200Success
application/json
post
POST /api/payments/checkouts HTTP/1.1
Host: test.bagelpay.io
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 250

{
  "product_id": "prod_1964884901818347521",
  "request_id": "requst_123456789",
  "units": "1",
  "customer": {
    "email": "user@example.com"
  },
  "success_url": "https://www.yoursite.com/success_callback",
  "metadata": {
    "key_1": "value_1",
    "key_2": "value_2",
    "key_N": "value_N"
  }
}
200Success
{
  "msg": "Operation successful",
  "code": 200,
  "data": {
    "object": "checkout",
    "units": 1,
    "metadata": {
      "key_1": "value_1",
      "key_2": "value_2",
      "key_N": "value_N"
    },
    "status": "pending",
    "mode": "test",
    "payment_id": "ch_1966064612594069506",
    "product_id": "prod_1966053095265972226",
    "request_id": "requst_123456789",
    "success_url": "https://www.yoursite.com/success_callback",
    "checkout_url": "https://test.bagelpay.io/checkout/prod_1966053095265972226/ch_1966064612594069506",
    "created_at": "2025-09-11T17:01:46.065+08:00",
    "updated_at": "2025-09-11T17:01:46.065+08:00",
    "expires_on": "2025-09-11T18:01:46.065+08:00"
  }
}