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

# Endpoints

## Fetch a basket by its identifier

> Gets the basket associated with the provided identifier.

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Basket":{"type":"object","properties":{"ident":{"type":"string"},"expire":{"type":"string"},"price":{"type":"number","format":"float"},"priceDetails":{"$ref":"#/components/schemas/PriceDetails"},"isPaymentMethodUpdate":{"type":"boolean"},"returnUrl":{"type":"string","nullable":true},"complete":{"type":"boolean"},"tax":{"type":"number","format":"int32"},"username":{"type":"string","nullable":true},"email_immutable":{"type":"boolean"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"address":{"$ref":"#/components/schemas/Address"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BasketRow"}},"fingerprint":{"type":"string","description":"Browser fingerprint to identify the user","nullable":true},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"roundup":{"type":"boolean","nullable":true},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"recurring_items":{"type":"array","items":{"type":"object"}},"payment":{"type":"object","$ref":"#/components/schemas/Payment"},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"PriceDetails":{"type":"object","properties":{"fullPrice":{"type":"number","format":"float"},"subTotal":{"type":"number","format":"float"},"discounts":{"type":"array","items":{"type":"object"}},"total":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"balance":{"type":"number","format":"float"},"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"recurring":{"type":"boolean","description":"Contains recurring amount. Limited to 1 subscription package in the basket at a time."},"username":{"type":"string"},"roundUp":{"type":"number","nullable":true}}},"Sale":{"type":"object","properties":{"name":{"type":"string","description":"The name of the sale (displayed to the customer)"},"discount_type":{"type":"string","enum":["percentage","amount"],"description":"The type of discount, either `percentage` for deducting a percentage of each item, or `amount` to deduct a fixed amount from each item."},"amount":{"type":"number","description":"The amount or percentage to deduct"}}},"GiftCard":{"type":"object"},"Discount":{"type":"object"},"Coupon":{"type":"object"},"Address":{"type":"object","properties":{"name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"state_id":{"type":"string","nullable":true},"country":{"type":"string"},"postal_code":{"type":"string"}}},"BasketRow":{"type":"object","properties":{"id":{"type":"integer"},"basket":{"type":"integer","description":"Numeric basket ID"},"package":{"type":"integer","nullable":true,"description":"Package ID associated with this item"},"override":{"type":"integer","description":"Package ID associated with this item"},"quantity":{"type":"integer"},"server":{"type":"integer","nullable":true},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"integer","nullable":true},"options":{"type":"object","nullable":true},"recurring":{"type":"boolean"},"recurring_period":{"type":"string","nullable":true},"recurring_next_payment_date":{"type":"string","format":"date-time","nullable":true},"meta":{"type":"object","properties":{"name":{"type":"string"},"rowprice":{"type":"number","format":"float"},"initialprice":{"type":"number","format":"float"},"isCumulative":{"type":"boolean"},"requiredPackages":{"type":"array","items":{"type":"integer"}},"requiresAny":{"type":"boolean"},"category":{"type":"boolean"},"producesGiftCard":{"type":"boolean"},"allowsGiftCards":{"type":"boolean"},"servers":{"type":"array","items":{"type":"integer"}},"limits":{"type":"object","properties":{"user":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"global":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"packageExpiryTime":{"type":"integer"}}},"hasDeliverables":{"type":"boolean"},"deliverableTypes":{"type":"array","items":{"type":"string"}},"downloadLink":{"type":"string"},"hasSellerProtection":{"type":"boolean"},"itemType":{"type":"string","nullable":true},"revenue_share":{"type":"array","items":{"type":"number","format":"float"}},"image":{"type":"string","nullable":true},"realprice":{"type":"number","format":"float"}}},"custom":{"type":"object","nullable":true},"image_url":{"type":"string","nullable":true},"recurring_price":{"type":"number","format":"float","nullable":true}}},"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}},"paths":{"/baskets/{ident}":{"get":{"tags":["Baskets"],"operationId":"getBasketById","summary":"Fetch a basket by its identifier","parameters":[{"in":"path","name":"ident","schema":{"type":"string"},"required":true,"description":"The basket identifier."}],"description":"Gets the basket associated with the provided identifier.","responses":{"200":{"description":"Successful response returns the basket.\n\nThe `links.payment` property is only returned if the basket has been paid for, and a payment exist with the **complete**/**refund**/**chargeback** status.\n\nThe `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to in order to complete payment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"404":{"description":"Basket not found."}}}}}}
```

## Create a basket that can be used to pay for items

> This will create and return a \`Basket\` that can be paid for by redirecting the user to \`links.checkout\`

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Basket":{"type":"object","properties":{"ident":{"type":"string"},"expire":{"type":"string"},"price":{"type":"number","format":"float"},"priceDetails":{"$ref":"#/components/schemas/PriceDetails"},"isPaymentMethodUpdate":{"type":"boolean"},"returnUrl":{"type":"string","nullable":true},"complete":{"type":"boolean"},"tax":{"type":"number","format":"int32"},"username":{"type":"string","nullable":true},"email_immutable":{"type":"boolean"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"address":{"$ref":"#/components/schemas/Address"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BasketRow"}},"fingerprint":{"type":"string","description":"Browser fingerprint to identify the user","nullable":true},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"roundup":{"type":"boolean","nullable":true},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"recurring_items":{"type":"array","items":{"type":"object"}},"payment":{"type":"object","$ref":"#/components/schemas/Payment"},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"PriceDetails":{"type":"object","properties":{"fullPrice":{"type":"number","format":"float"},"subTotal":{"type":"number","format":"float"},"discounts":{"type":"array","items":{"type":"object"}},"total":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"balance":{"type":"number","format":"float"},"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"recurring":{"type":"boolean","description":"Contains recurring amount. Limited to 1 subscription package in the basket at a time."},"username":{"type":"string"},"roundUp":{"type":"number","nullable":true}}},"Sale":{"type":"object","properties":{"name":{"type":"string","description":"The name of the sale (displayed to the customer)"},"discount_type":{"type":"string","enum":["percentage","amount"],"description":"The type of discount, either `percentage` for deducting a percentage of each item, or `amount` to deduct a fixed amount from each item."},"amount":{"type":"number","description":"The amount or percentage to deduct"}}},"GiftCard":{"type":"object"},"Discount":{"type":"object"},"Coupon":{"type":"object"},"Address":{"type":"object","properties":{"name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"state_id":{"type":"string","nullable":true},"country":{"type":"string"},"postal_code":{"type":"string"}}},"BasketRow":{"type":"object","properties":{"id":{"type":"integer"},"basket":{"type":"integer","description":"Numeric basket ID"},"package":{"type":"integer","nullable":true,"description":"Package ID associated with this item"},"override":{"type":"integer","description":"Package ID associated with this item"},"quantity":{"type":"integer"},"server":{"type":"integer","nullable":true},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"integer","nullable":true},"options":{"type":"object","nullable":true},"recurring":{"type":"boolean"},"recurring_period":{"type":"string","nullable":true},"recurring_next_payment_date":{"type":"string","format":"date-time","nullable":true},"meta":{"type":"object","properties":{"name":{"type":"string"},"rowprice":{"type":"number","format":"float"},"initialprice":{"type":"number","format":"float"},"isCumulative":{"type":"boolean"},"requiredPackages":{"type":"array","items":{"type":"integer"}},"requiresAny":{"type":"boolean"},"category":{"type":"boolean"},"producesGiftCard":{"type":"boolean"},"allowsGiftCards":{"type":"boolean"},"servers":{"type":"array","items":{"type":"integer"}},"limits":{"type":"object","properties":{"user":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"global":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"packageExpiryTime":{"type":"integer"}}},"hasDeliverables":{"type":"boolean"},"deliverableTypes":{"type":"array","items":{"type":"string"}},"downloadLink":{"type":"string"},"hasSellerProtection":{"type":"boolean"},"itemType":{"type":"string","nullable":true},"revenue_share":{"type":"array","items":{"type":"number","format":"float"}},"image":{"type":"string","nullable":true},"realprice":{"type":"number","format":"float"}}},"custom":{"type":"object","nullable":true},"image_url":{"type":"string","nullable":true},"recurring_price":{"type":"number","format":"float","nullable":true}}},"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}},"paths":{"/baskets":{"post":{"tags":["Baskets"],"summary":"Create a basket that can be used to pay for items","description":"This will create and return a `Basket` that can be paid for by redirecting the user to `links.checkout`","operationId":"createBasket","requestBody":{"description":"Create a basket, returning the full basket object and payment link.","content":{"application/json":{"schema":{"type":"object","properties":{"return_url":{"type":"string","description":"The URL a customer can return to without completing checkout"},"complete_url":{"type":"string","description":"URL the customer can return to after completing payment"},"custom":{"type":"object","description":"Any custom data to be passed through the request. This will be returned in a post-completion webhook."},"first_name":{"type":"string","description":"The first name of the customer"},"last_name":{"type":"string","description":"The last name of the customer"},"email":{"type":"string","description":"The email address of the customer"},"complete_auto_redirect":{"type":"boolean","description":"Automatically redirect to the complete_url provided"},"country":{"type":"string","description":"An ISO 3166-1 alpha-2 character code representing the customer's country."},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"ip":{"type":"string","description":"The IP address of the customer using this basket. Provide the IP if creating a basket on your server backend."}}}}}},"responses":{"200":{"description":"Basket created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}}}}}}}
```

## Add a package to the basket

> This adds a package (an object describing the product) to the basket \`{ident}\`. For subscriptions, \*\*only one subscription item may be in a basket at a time\*\*, and it cannot be included with one-time payment items. \*\*This endpoint requires prior approval. Please contact your account manager.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Package":{"type":"object","properties":{"name":{"type":"string","description":"The name of the item being purchased. This should be user-friendly as it is shown to the customer on checkout and receipts."},"price":{"type":"number","format":"float","description":"A float (decimal describing the price of the package in your account currency)"},"type":{"type":"string","enum":["single","subscription"]},"expiry_period":{"type":"string","enum":["day","month","year"],"description":"The renewal period of this item"},"expiry_length":{"type":"integer","description":"An integer representing the number of `expiry_periods` that make up the renewal period."},"custom":{"type":"object","description":"A map of data that is passed back to you via the webhook (for example, a tracking ID)"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"Basket":{"type":"object","properties":{"ident":{"type":"string"},"expire":{"type":"string"},"price":{"type":"number","format":"float"},"priceDetails":{"$ref":"#/components/schemas/PriceDetails"},"isPaymentMethodUpdate":{"type":"boolean"},"returnUrl":{"type":"string","nullable":true},"complete":{"type":"boolean"},"tax":{"type":"number","format":"int32"},"username":{"type":"string","nullable":true},"email_immutable":{"type":"boolean"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"address":{"$ref":"#/components/schemas/Address"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BasketRow"}},"fingerprint":{"type":"string","description":"Browser fingerprint to identify the user","nullable":true},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"roundup":{"type":"boolean","nullable":true},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"recurring_items":{"type":"array","items":{"type":"object"}},"payment":{"type":"object","$ref":"#/components/schemas/Payment"},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"PriceDetails":{"type":"object","properties":{"fullPrice":{"type":"number","format":"float"},"subTotal":{"type":"number","format":"float"},"discounts":{"type":"array","items":{"type":"object"}},"total":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"balance":{"type":"number","format":"float"},"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"recurring":{"type":"boolean","description":"Contains recurring amount. Limited to 1 subscription package in the basket at a time."},"username":{"type":"string"},"roundUp":{"type":"number","nullable":true}}},"Sale":{"type":"object","properties":{"name":{"type":"string","description":"The name of the sale (displayed to the customer)"},"discount_type":{"type":"string","enum":["percentage","amount"],"description":"The type of discount, either `percentage` for deducting a percentage of each item, or `amount` to deduct a fixed amount from each item."},"amount":{"type":"number","description":"The amount or percentage to deduct"}}},"GiftCard":{"type":"object"},"Discount":{"type":"object"},"Coupon":{"type":"object"},"Address":{"type":"object","properties":{"name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"state_id":{"type":"string","nullable":true},"country":{"type":"string"},"postal_code":{"type":"string"}}},"BasketRow":{"type":"object","properties":{"id":{"type":"integer"},"basket":{"type":"integer","description":"Numeric basket ID"},"package":{"type":"integer","nullable":true,"description":"Package ID associated with this item"},"override":{"type":"integer","description":"Package ID associated with this item"},"quantity":{"type":"integer"},"server":{"type":"integer","nullable":true},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"integer","nullable":true},"options":{"type":"object","nullable":true},"recurring":{"type":"boolean"},"recurring_period":{"type":"string","nullable":true},"recurring_next_payment_date":{"type":"string","format":"date-time","nullable":true},"meta":{"type":"object","properties":{"name":{"type":"string"},"rowprice":{"type":"number","format":"float"},"initialprice":{"type":"number","format":"float"},"isCumulative":{"type":"boolean"},"requiredPackages":{"type":"array","items":{"type":"integer"}},"requiresAny":{"type":"boolean"},"category":{"type":"boolean"},"producesGiftCard":{"type":"boolean"},"allowsGiftCards":{"type":"boolean"},"servers":{"type":"array","items":{"type":"integer"}},"limits":{"type":"object","properties":{"user":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"global":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"packageExpiryTime":{"type":"integer"}}},"hasDeliverables":{"type":"boolean"},"deliverableTypes":{"type":"array","items":{"type":"string"}},"downloadLink":{"type":"string"},"hasSellerProtection":{"type":"boolean"},"itemType":{"type":"string","nullable":true},"revenue_share":{"type":"array","items":{"type":"number","format":"float"}},"image":{"type":"string","nullable":true},"realprice":{"type":"number","format":"float"}}},"custom":{"type":"object","nullable":true},"image_url":{"type":"string","nullable":true},"recurring_price":{"type":"number","format":"float","nullable":true}}},"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}},"paths":{"/baskets/{ident}/packages":{"post":{"parameters":[{"in":"path","name":"ident","schema":{"type":"string"},"required":true,"description":"The basket identifier."}],"tags":["Baskets"],"operationId":"addPackage","summary":"Add a package to the basket","description":"This adds a package (an object describing the product) to the basket `{ident}`. For subscriptions, **only one subscription item may be in a basket at a time**, and it cannot be included with one-time payment items. **This endpoint requires prior approval. Please contact your account manager.**","requestBody":{"content":{"application/json":{"schema":{"properties":{"package":{"$ref":"#/components/schemas/Package"},"qty":{"type":"integer","description":"The quantity of `package` in this basket. This is not the total quantity of overall items in the basket."},"type":{"type":"string","enum":["single","subscription"],"description":"The type of payment, either `single` for one-time payments or `subscription`.","required":["single"]},"revenue_share":{"type":"array","description":"An array of payment destination objects describing how the purchase should be split between multiple wallets. **Only available with pre-agreement from Tebex.**","items":{"$ref":"#/components/schemas/RevenueShare"}}}}}}},"responses":{"200":{"description":"Package is successfully added to the basket, and basket is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"400":{"description":"Improperly formatted package. See ErrorResponse."},"404":{"description":"Basket not found."}}}}}}
```

## Remove a row from the basket

> This will remove the given \`{rows.id}\` from the basket \`{ident}\`. The basket must be re-fetched after running to receive updated totals.

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}}},"paths":{"/baskets/{ident}/packages/{rows.id}":{"delete":{"parameters":[{"in":"path","name":"ident","schema":{"type":"string"},"required":true,"description":"The basket identifier."},{"in":"path","name":"rows.id","schema":{"type":"integer"},"required":true,"description":"The `id` of the `basket.rows` row to remove."}],"tags":["Baskets"],"operationId":"removeRowFromBasket","summary":"Remove a row from the basket","description":"This will remove the given `{rows.id}` from the basket `{ident}`. The basket must be re-fetched after running to receive updated totals.","responses":{"204":{"description":"Successfully deleted a row from the basket."},"404":{"description":"Row or basket not found."}}}}}}
```

## Add a sale to the basket

> Adds a \`Sale\` to the basket with \`{ident}\`. \*\*Sales cannot be applied to baskets with \`revenue\_share\` set.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Sale":{"type":"object","properties":{"name":{"type":"string","description":"The name of the sale (displayed to the customer)"},"discount_type":{"type":"string","enum":["percentage","amount"],"description":"The type of discount, either `percentage` for deducting a percentage of each item, or `amount` to deduct a fixed amount from each item."},"amount":{"type":"number","description":"The amount or percentage to deduct"}}},"Basket":{"type":"object","properties":{"ident":{"type":"string"},"expire":{"type":"string"},"price":{"type":"number","format":"float"},"priceDetails":{"$ref":"#/components/schemas/PriceDetails"},"isPaymentMethodUpdate":{"type":"boolean"},"returnUrl":{"type":"string","nullable":true},"complete":{"type":"boolean"},"tax":{"type":"number","format":"int32"},"username":{"type":"string","nullable":true},"email_immutable":{"type":"boolean"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"address":{"$ref":"#/components/schemas/Address"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BasketRow"}},"fingerprint":{"type":"string","description":"Browser fingerprint to identify the user","nullable":true},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"roundup":{"type":"boolean","nullable":true},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"recurring_items":{"type":"array","items":{"type":"object"}},"payment":{"type":"object","$ref":"#/components/schemas/Payment"},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"PriceDetails":{"type":"object","properties":{"fullPrice":{"type":"number","format":"float"},"subTotal":{"type":"number","format":"float"},"discounts":{"type":"array","items":{"type":"object"}},"total":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"balance":{"type":"number","format":"float"},"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"recurring":{"type":"boolean","description":"Contains recurring amount. Limited to 1 subscription package in the basket at a time."},"username":{"type":"string"},"roundUp":{"type":"number","nullable":true}}},"GiftCard":{"type":"object"},"Discount":{"type":"object"},"Coupon":{"type":"object"},"Address":{"type":"object","properties":{"name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"state_id":{"type":"string","nullable":true},"country":{"type":"string"},"postal_code":{"type":"string"}}},"BasketRow":{"type":"object","properties":{"id":{"type":"integer"},"basket":{"type":"integer","description":"Numeric basket ID"},"package":{"type":"integer","nullable":true,"description":"Package ID associated with this item"},"override":{"type":"integer","description":"Package ID associated with this item"},"quantity":{"type":"integer"},"server":{"type":"integer","nullable":true},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"integer","nullable":true},"options":{"type":"object","nullable":true},"recurring":{"type":"boolean"},"recurring_period":{"type":"string","nullable":true},"recurring_next_payment_date":{"type":"string","format":"date-time","nullable":true},"meta":{"type":"object","properties":{"name":{"type":"string"},"rowprice":{"type":"number","format":"float"},"initialprice":{"type":"number","format":"float"},"isCumulative":{"type":"boolean"},"requiredPackages":{"type":"array","items":{"type":"integer"}},"requiresAny":{"type":"boolean"},"category":{"type":"boolean"},"producesGiftCard":{"type":"boolean"},"allowsGiftCards":{"type":"boolean"},"servers":{"type":"array","items":{"type":"integer"}},"limits":{"type":"object","properties":{"user":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"global":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"packageExpiryTime":{"type":"integer"}}},"hasDeliverables":{"type":"boolean"},"deliverableTypes":{"type":"array","items":{"type":"string"}},"downloadLink":{"type":"string"},"hasSellerProtection":{"type":"boolean"},"itemType":{"type":"string","nullable":true},"revenue_share":{"type":"array","items":{"type":"number","format":"float"}},"image":{"type":"string","nullable":true},"realprice":{"type":"number","format":"float"}}},"custom":{"type":"object","nullable":true},"image_url":{"type":"string","nullable":true},"recurring_price":{"type":"number","format":"float","nullable":true}}},"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}},"paths":{"/baskets/{ident}/sales":{"post":{"parameters":[{"in":"path","name":"ident","schema":{"type":"string"},"required":true,"description":"The basket identifier."}],"tags":["Baskets"],"operationId":"addSaleToBasket","summary":"Add a sale to the basket","description":"Adds a `Sale` to the basket with `{ident}`. **Sales cannot be applied to baskets with `revenue_share` set.**","requestBody":{"description":"Provide a `Sale` as an object to apply it to the basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sale"}}}},"responses":{"200":{"description":"Successfully adds sale to basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"400":{"description":"Bad request. Improperly formatted Sale or this basket cannot accept sales. See ErrorResponse."},"404":{"description":"Basket not found."}}}}}}
```

## Create a checkout request

> This API call allows the complete checkout flow (create basket, add items, add sale) to be made in a single API call, for when the Seller is managing the basket locally. \*\*This endpoint requires prior approval - please contact your account manager.\*\*

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"CheckoutItem":{"type":"object","description":"An item added to a basket as part of the `/checkout` request.","properties":{"package":{"$ref":"#/components/schemas/Package"},"qty":{"type":"integer","description":"The quantity of `package` to add to the basket. This must be provided alongside `package`, not inside it - a `qty` nested within the package object is silently ignored and the item is added with a quantity of 1."}}},"Package":{"type":"object","properties":{"name":{"type":"string","description":"The name of the item being purchased. This should be user-friendly as it is shown to the customer on checkout and receipts."},"price":{"type":"number","format":"float","description":"A float (decimal describing the price of the package in your account currency)"},"type":{"type":"string","enum":["single","subscription"]},"expiry_period":{"type":"string","enum":["day","month","year"],"description":"The renewal period of this item"},"expiry_length":{"type":"integer","description":"An integer representing the number of `expiry_periods` that make up the renewal period."},"custom":{"type":"object","description":"A map of data that is passed back to you via the webhook (for example, a tracking ID)"}}},"Sale":{"type":"object","properties":{"name":{"type":"string","description":"The name of the sale (displayed to the customer)"},"discount_type":{"type":"string","enum":["percentage","amount"],"description":"The type of discount, either `percentage` for deducting a percentage of each item, or `amount` to deduct a fixed amount from each item."},"amount":{"type":"number","description":"The amount or percentage to deduct"}}},"Basket":{"type":"object","properties":{"ident":{"type":"string"},"expire":{"type":"string"},"price":{"type":"number","format":"float"},"priceDetails":{"$ref":"#/components/schemas/PriceDetails"},"isPaymentMethodUpdate":{"type":"boolean"},"returnUrl":{"type":"string","nullable":true},"complete":{"type":"boolean"},"tax":{"type":"number","format":"int32"},"username":{"type":"string","nullable":true},"email_immutable":{"type":"boolean"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"address":{"$ref":"#/components/schemas/Address"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/BasketRow"}},"fingerprint":{"type":"string","description":"Browser fingerprint to identify the user","nullable":true},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"roundup":{"type":"boolean","nullable":true},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"recurring_items":{"type":"array","items":{"type":"object"}},"payment":{"type":"object","$ref":"#/components/schemas/Payment"},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"PriceDetails":{"type":"object","properties":{"fullPrice":{"type":"number","format":"float"},"subTotal":{"type":"number","format":"float"},"discounts":{"type":"array","items":{"type":"object"}},"total":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"balance":{"type":"number","format":"float"},"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"recurring":{"type":"boolean","description":"Contains recurring amount. Limited to 1 subscription package in the basket at a time."},"username":{"type":"string"},"roundUp":{"type":"number","nullable":true}}},"GiftCard":{"type":"object"},"Discount":{"type":"object"},"Coupon":{"type":"object"},"Address":{"type":"object","properties":{"name":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"state_id":{"type":"string","nullable":true},"country":{"type":"string"},"postal_code":{"type":"string"}}},"BasketRow":{"type":"object","properties":{"id":{"type":"integer"},"basket":{"type":"integer","description":"Numeric basket ID"},"package":{"type":"integer","nullable":true,"description":"Package ID associated with this item"},"override":{"type":"integer","description":"Package ID associated with this item"},"quantity":{"type":"integer"},"server":{"type":"integer","nullable":true},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"integer","nullable":true},"options":{"type":"object","nullable":true},"recurring":{"type":"boolean"},"recurring_period":{"type":"string","nullable":true},"recurring_next_payment_date":{"type":"string","format":"date-time","nullable":true},"meta":{"type":"object","properties":{"name":{"type":"string"},"rowprice":{"type":"number","format":"float"},"initialprice":{"type":"number","format":"float"},"isCumulative":{"type":"boolean"},"requiredPackages":{"type":"array","items":{"type":"integer"}},"requiresAny":{"type":"boolean"},"category":{"type":"boolean"},"producesGiftCard":{"type":"boolean"},"allowsGiftCards":{"type":"boolean"},"servers":{"type":"array","items":{"type":"integer"}},"limits":{"type":"object","properties":{"user":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"global":{"type":"object","properties":{"enabled":{"type":"boolean"},"timestamp":{"type":"integer"},"limit":{"type":"boolean"}}},"packageExpiryTime":{"type":"integer"}}},"hasDeliverables":{"type":"boolean"},"deliverableTypes":{"type":"array","items":{"type":"string"}},"downloadLink":{"type":"string"},"hasSellerProtection":{"type":"boolean"},"itemType":{"type":"string","nullable":true},"revenue_share":{"type":"array","items":{"type":"number","format":"float"}},"image":{"type":"string","nullable":true},"realprice":{"type":"number","format":"float"}}},"custom":{"type":"object","nullable":true},"image_url":{"type":"string","nullable":true},"recurring_price":{"type":"number","format":"float","nullable":true}}},"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}},"paths":{"/checkout":{"post":{"tags":["Checkout"],"operationId":"checkout","summary":"Create a checkout request","description":"This API call allows the complete checkout flow (create basket, add items, add sale) to be made in a single API call, for when the Seller is managing the basket locally. **This endpoint requires prior approval - please contact your account manager.**","requestBody":{"description":"Provide a `Basket`, an array of `Packages` to be added to the basket, and an optional `Sale` to complete the full checkout flow in one call. **Only one subscription item may be in the basket at a time.**","content":{"application/json":{"schema":{"required":["basket","items"],"properties":{"basket":{"description":"An object containing the customer's information, relevant links, and any custom tracking data.","type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"return_url":{"type":"string"},"complete_url":{"type":"string"},"custom":{"type":"object"}}},"items":{"type":"array","description":"An array of `Packages` in the basket.","items":{"$ref":"#/components/schemas/CheckoutItem"}},"sale":{"$ref":"#/components/schemas/Sale"}}}}}},"responses":{"200":{"description":"Successfully created basket. The basket will be returned with `links` containing the URLs you should direct the customer to in order to complete payment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"400":{"description":"Bad Request. See ErrorResponse."}}}}}}
```

## Fetch a payment by its transaction ID

> This will fetch the given payment associated with this transaction id. Single payment transaction IDs begin with \`tbx-\`

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Payments","description":"Single payments (`tbx-`) can be fetched and refunded with a valid reference id."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}}}},"paths":{"/payments/{txnId}?type=txn_id":{"get":{"tags":["Payments"],"operationId":"getPaymentById","summary":"Fetch a payment by its transaction ID","description":"This will fetch the given payment associated with this transaction id. Single payment transaction IDs begin with `tbx-`","parameters":[{"in":"path","name":"txnId","schema":{"type":"string"},"required":true,"description":"The payment reference to fetch."}],"responses":{"200":{"description":"Payment fetched successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"404":{"description":"Transaction not found."}}}}}}
```

## Refund a payment by its transaction ID

> This will refund the given payment associated with this transaction id.

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Payments","description":"Single payments (`tbx-`) can be fetched and refunded with a valid reference id."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"Payment":{"type":"object","nullable":true,"properties":{"transaction_id":{"type":"string"},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"payment_sequence":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"price_paid":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"payment_method":{"type":"object","properties":{"name":{},"refundable":{"type":"boolean"}}},"revenue_share":{"type":"array","items":{"$ref":"#/components/schemas/RevenueShare"}},"decline_reason":{"type":"string"},"fees":{"type":"object","properties":{"tax":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"gateway":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}}}},"customer":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string"},"ip":{"type":"string"},"username":{"type":"string","nullable":true},"marketing_consent":{"type":"boolean"},"country":{"type":"string"},"postal_code":{"type":"string","nullable":true}}},"products":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"quantity":{"type":"integer"},"base_price":{"properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"paid_price":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"currency":{"type":"string"}}},"variables":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time","nullable":true},"custom":{"type":"object","description":"Any custom data associated with the payment"},"username":{"type":"string","nullable":true}}}},"coupons":{"type":"array","items":{"type":"object"}},"gift_cards":{"type":"array","items":{"type":"object"}},"recurring_payment_reference":{"type":"string","nullable":true},"custom":{"type":"object"}}},"RevenueShare":{"type":"object","nullable":true,"properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","format":"float","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","format":"float","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}}}},"paths":{"/payments/{txnId}/refund?type=txn_id":{"post":{"tags":["Payments"],"operationId":"refundPaymentById","summary":"Refund a payment by its transaction ID","description":"This will refund the given payment associated with this transaction id.","parameters":[{"in":"path","name":"txnId","schema":{"type":"string"},"required":true,"description":"The payment reference to refund."}],"responses":{"200":{"description":"Payment refunded successfully. The payment details are returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"404":{"description":"Payment not found."},"422":{"description":"The payment cannot be refunded. Payments can only be refunded when a payment's `status` is Completed."}}}}}}
```

## GET /recurring-payments/{reference}

> Fetch a recurring payment (subscription) by its reference

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Recurring Payments","description":"Payments with reference IDs like `tbx-r-`. Can be paused, reeactivated, and cancelled provided a valid reference id."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"RecurringPayment":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"paused_at":{"type":"string","format":"date-time","nullable":true},"paused_until":{"type":"string","format":"date-time","nullable":true},"next_payment_date":{"type":"string"},"reference":{"type":"string"},"account_id":{"type":"integer"},"interval":{"type":"string"},"cancelled_at":{"type":"string","format":"date-time","nullable":true},"cancellation_requested_at":{"type":"string","format":"date-time","nullable":true},"status":{"type":"object","properties":{"id":{"type":"integer"},"class":{"type":"string"},"description":{"type":"string"},"active":{"type":"integer"}}},"amount":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"period":{"type":"string"}}},"cancel_reason":{"type":"string","nullable":true},"links":{"type":"object","properties":{"initial_payment":{"type":"string"},"payment_history":{"type":"array","items":{"type":"string"}}}}}}}},"paths":{"/recurring-payments/{reference}":{"get":{"tags":["Recurring Payments"],"operationId":"getRecurringPayment","summary":"Fetch a recurring payment (subscription) by its reference","parameters":[{"in":"path","name":"reference","schema":{"type":"string"},"required":true,"description":"The recurring payment reference to fetch."}],"responses":{"200":{"description":"Successfully fetched recurring payment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringPayment"}}}},"404":{"description":"Recurring payment not found."}}}}}}
```

{% openapi src="/files/9GpXba7VxXu1zKOFJQ2I" path="/recurring-payments/{reference}" method="put" %}
[checkout-api.yaml](https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2FxlNyfP91gTDjFnH9lvfH%2Fcheckout-api.yaml?alt=media\&token=b7e53337-137e-47cd-885f-bbea7aa22554)
{% endopenapi %}

{% openapi src="/files/9GpXba7VxXu1zKOFJQ2I" path="/recurring-payments/{reference}" method="delete" %}
[checkout-api.yaml](https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2FxlNyfP91gTDjFnH9lvfH%2Fcheckout-api.yaml?alt=media\&token=b7e53337-137e-47cd-885f-bbea7aa22554)
{% endopenapi %}

## PUT /recurring-payments/{reference}/status

> Pause or reactivate a recurring payment

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Recurring Payments","description":"Payments with reference IDs like `tbx-r-`. Can be paused, reeactivated, and cancelled provided a valid reference id."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}},"schemas":{"RecurringPayment":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"paused_at":{"type":"string","format":"date-time","nullable":true},"paused_until":{"type":"string","format":"date-time","nullable":true},"next_payment_date":{"type":"string"},"reference":{"type":"string"},"account_id":{"type":"integer"},"interval":{"type":"string"},"cancelled_at":{"type":"string","format":"date-time","nullable":true},"cancellation_requested_at":{"type":"string","format":"date-time","nullable":true},"status":{"type":"object","properties":{"id":{"type":"integer"},"class":{"type":"string"},"description":{"type":"string"},"active":{"type":"integer"}}},"amount":{"type":"object","properties":{"amount":{"type":"number","format":"float"},"tax":{"type":"number","format":"float"},"period":{"type":"string"}}},"cancel_reason":{"type":"string","nullable":true},"links":{"type":"object","properties":{"initial_payment":{"type":"string"},"payment_history":{"type":"array","items":{"type":"string"}}}}}}}},"paths":{"/recurring-payments/{reference}/status":{"put":{"tags":["Recurring Payments"],"operationId":"updateRecurringPayment","summary":"Pause or reactivate a recurring payment","parameters":[{"in":"path","name":"reference","schema":{"type":"string"},"required":true,"description":"The recurring payment reference to update."}],"requestBody":{"content":{"application/json":{"schema":{"required":["status"],"properties":{"status":{"type":"string","enum":["Paused","Active"],"description":"Your desired state of the recurring payment. Provide `Paused` with `paused_until` to pause a recurring payment. Otherwise, provide `Active` to resume a recurring payment."},"paused_until":{"type":"string","description":"To pause a payment, provide a ISO8601 formatted date on which the payment should be reactivated."}}}}}},"responses":{"200":{"description":"Successfully paused or reactivated a payment. The `RecurringPayment` is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringPayment"}}}},"404":{"description":"Recurring payment not found."},"422":{"description":"Unprocessible Entity. An invalid status was provided or the recurring payment cannot be processed. See ErrorResponse."}}}}}}
```

## Update a basket's details, including expiry date.

> This will update the customer's details on the basket. If the customer is already logged in and a new email is provided, they will be logged out.

```json
{"openapi":"3.0.3","info":{"title":"Tebex Checkout API","version":"1.1.5"},"tags":[{"name":"Baskets","description":"To start a transaction, a basket must be created. The basket, similar to a standard eCommerce basket will contain the items that the customer is purchasing."}],"servers":[{"url":"https://checkout.tebex.io/api"}],"security":[{"tebex_checkout_auth_basic":[]}],"components":{"securitySchemes":{"tebex_checkout_auth_basic":{"type":"http","scheme":"basic"}}},"paths":{"/baskets/{ident}":{"put":{"tags":["Baskets"],"summary":"Update a basket's details, including expiry date.","parameters":[{"in":"path","name":"ident","schema":{"type":"string"},"required":true,"description":"The basket identifier."}],"description":"This will update the customer's details on the basket. If the customer is already logged in and a new email is provided, they will be logged out.","operationId":"updateBasket","requestBody":{"description":"The parameters of the basket you wish to update.","content":{"application/json":{"schema":{"type":"object","properties":{"country":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"state_id":{"type":"string","nullable":true},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true},"creator_code":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean","nullable":true},"expires_at":{"type":"string","format":"date-time","description":"An ISO8601 formatted date. After this date the basket cannot be used to checkout.","nullable":true}}}}}},"responses":{"200":{"description":"Basket updated successfully"},"404":{"description":"Basket not found."}}}}}}
```
