> For the complete documentation index, see [llms.txt](https://bagelpay.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bagelpay.gitbook.io/docs/apireference/api-document/checkout.md).

# Checkout

## Create Checkout Session

> Create a checkout session with a product ID.\ <br>

```json
{"openapi":"3.1.0","info":{"title":"BagelPay-SDK","version":"1.0.0"},"tags":[{"name":"Checkout"}],"servers":[{"url":"https://test.bagelpay.io","description":"Development env"}],"security":[],"paths":{"/api/payments/checkouts":{"post":{"summary":"Create Checkout Session","deprecated":false,"description":"Create a checkout session with a product ID.\n\n","tags":["Checkout"],"parameters":[{"name":"x-api-key","in":"header","description":"Your API Keys","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"product_id":{"type":"string","description":"The unique identifier of the product. You can get the product id in dashboard."},"request_id":{"type":"string","description":"When creating a checkout-session, you can optionally add a request_id parameter to track the payment. \nThis 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."},"units":{"type":"string","description":"The number of units for the order.\nDefault value is 1."},"customer":{"type":"object","properties":{"email":{"type":"string"}},"description":"Customer data for checkout session. This will prefill the customer info on the checkout page."},"success_url":{"type":"string","description":"The URL to which the user will be redirected after the checkout process is completed.\nYou 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)."},"metadata":{"type":"object","properties":{"key_1":{"type":"string"},"key_2":{"type":"string"},"key_N":{"type":"string"}},"description":"Metadata for the checkout in the form of key-value pairs."}},"required":["product_id","customer"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string"},"code":{"type":"integer"},"data":{"type":"object","properties":{"object":{"type":"string"},"units":{"type":"integer"},"metadata":{"type":"object","properties":{"key_1":{"type":"string"},"key_2":{"type":"string"},"key_N":{"type":"string"}},"required":["key_1","key_2","key_N"]},"status":{"type":"string"},"mode":{"type":"string"},"payment_id":{"type":"string"},"product_id":{"type":"string"},"request_id":{"type":"string"},"success_url":{"type":"string"},"checkout_url":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"expires_on":{"type":"string"}},"required":["object","units","metadata","status","mode","payment_id","product_id","request_id","success_url","checkout_url","created_at","updated_at","expires_on"]}},"required":["msg","code","data"]}}},"headers":{}}}}}}}
```
