Hosted Checkout
Creates a new hosted checkout session
API to create a hosted checkout session. <br><strong>Access Token Required scope:</strong> checkout/sessions/create
post/v2/checkout/sessions
Request
- Base URLhttps://docs.teya.com (the document declares no server; this is the origin it was published from)
- Auth
- OAuth 2Authorization codehttps://id.teya.xyz/oauth/v2/oauth-authorizeClient credentialsToken URLhttps://id.teya.xyz/oauth/v2/oauth-token
- or OAuth 2Authorization codehttps://id.teya.com/oauth/v2/oauth-authorizeClient credentialsToken URLhttps://id.teya.com/oauth/v2/oauth-token
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
Idempotency-Keystring required
A unique key to identify the request. If the request is repeated with the same key, the same response will be returned. If the request is repeated with a different key or without a key, a new session will be created.
User-Agentstring required
Example:YourCompany-Integration/1.0
Identifies your integration, for example YourCompany-Integration/1.0. Requests without a User-Agent can be blocked by our firewall before they reach the API.
Request body
Example request
{
"amount": {
"currency": "USD",
"value": 100
},
"billing_address": {
"city": "London",
"country": "GB",
"state": "London",
"street_address_line1": "Main Street",
"street_address_line2": "No. 1",
"street_address_line3": "Building 1",
"zipcode": "10001"
},
"cancel_url": "https://mywebsite.com/checkout/cart",
"customer": {
"email": "emailaddress@example.com",
"name": "John Doe",
"phone_number": "+447911123456"
},
"customer_success_email": "john.doe@example.com",
"failure_url": "https://mywebsite.com/checkout/failure",
"language": "en-GB",
"line_items": [
{
"description": "Product 1",
"quantity": 1,
"unit_price": 100
},
{
"description": "Product 2",
"quantity": 2,
"unit_price": 50
}
],
"merchant_reference": "1234567890",
"merchant_success_email": "customer@mywebsite.com",
"metadata": {
"campaign": "summer_sale",
"order_id": "12345"
},
"post_success_payment": "SHOW_SUCCESS_PAGE",
"required_customer_fields": [
"SHIPPING_ADDRESS",
"EMAIL"
],
"save_payment_method": true,
"store_id": "123e4567-e89b-12d3-a456-426614174000",
"success_url": "https://mywebsite.com/checkout/success",
"type": "SALE"
}Response
Session has been created
Example response
{
"session_id": "14411456-79c8-4d8c-8498-f01907093b83",
"session_url": "https://checkout.teya.com/pay/14411456-79c8-4d8c-8498-f01907093b83"
}Changes
No recorded changes to this operation across all 1 revision of this API.