# Overview

The Checkout API is designed to allow creators to use Tebex's Merchant of Record platform without the need to use a Tebex-powered webstore.&#x20;

If you haven't already done so, we recommend having a read of our [quick start guide](https://docs.tebex.io/developers/getting-started) before beginning integration.

This means creators can create baskets with **custom products** (as opposed to **pre-created** products on our webstore platform), and send customers directly to the checkout flow to proceed with payment.

The Checkout API can be used with [Tebex.js](https://docs.tebex.io/developers/tebex.js) for a fully embedded checkout experience without the user ever leaving your own website.&#x20;

**Using the Checkout API requires prior approval from our compliance teams. Please note that the Checkout API is not available to some UGC creators, such as those on FiveM or RedM.**

## Terminology

<table><thead><tr><th width="150">Term</th><th width="595.4285714285713">Description</th></tr></thead><tbody><tr><td>Basket</td><td>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</td></tr><tr><td>Ident</td><td>A string identifier representing the basket</td></tr></tbody></table>

## Checkout API Flow

Below is the expected flow your application should follow when implementing the Checkout API. This should be considered a general guideline. For a full list of endpoints available, see the [Endpoints](https://docs.tebex.io/developers/checkout-api/endpoints) page.

You have two options for implementing Checkout API. We include a **Checkout** request where all data about the customer and their desired packages can be provided in one request.

### Option 1. Using the Checkout Request

If your app has existing basket functionality, we recommend using a **Checkout** request. You can send the details of your customer, basket, and sale information all in one request:

{% openapi src="<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>" path="/checkout" method="post" %}
[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 %}

### Option 2. Using the Tebex Basket

If you do not have existing basket functionality in your app, you can use the Checkout API to fully manage the customer's basket on Tebex:

1. Create a basket for the customer.
   * Your app should save the `ident` value for reference later, as this is the identifier for this customer's basket.

{% openapi src="<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>" path="/baskets" method="post" %}
[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 %}

2. Add or remove packages from the customer's basket as desired.

{% openapi src="<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>" path="/baskets/{ident}/packages" method="post" %}
[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="<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>" path="/baskets/{ident}/packages/{rows.id}" 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 %}

3. Add any desired sales / discounts to the basket

{% openapi src="<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>" path="/baskets/{ident}/sales" method="post" %}
[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 %}

4. Direct the user to the basket's `links.checkout` URL in order to complete payment.

{% openapi src="<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>" path="/baskets/{ident}" method="get" %}
[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 %}

5. After payment is complete, you may verify payment if you wish by checking the `links.payment` URL associated with the customer's basket.

## Recurring Payments

Tebex Checkout supports recurring payments in addition to single, one-time payments. Below are the endpoints you can use for managing a customer's recurring payments.

{% openapi src="<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>" path="/recurring-payments/{reference}" method="get" %}
[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="<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>" 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="<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>" 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 %}

{% openapi src="<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>" path="/recurring-payments/{reference}/status" 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 Schema and SDKs

Tebex Checkout is documented with OpenAPI. To view the schema and available SDKs, see our [releases](https://github.com/tebexio/TebexCheckout-OpenAPI/releases) on GitHub.

## Postman Schema

An importable Postman collection can always be downloaded from [Tebex Checkout's repository](https://github.com/tebexio/TebexCheckout-OpenAPI/releases) on GitHub.

## Examples

The following websites are integrated using the Checkout API.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td><strong>Lunarclient</strong></td><td><a href="https://store.lunarclient.com/">https://store.lunarclient.com/</a><br></td><td><a href="https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F5WJPcmGAmzkn4fW7lDiZ%2Flunar.png?alt=media&#x26;token=ece671c8-0c8f-40a7-8bc5-728494d4524d">lunar.png</a></td><td><a href="https://store.lunarclient.com/">https://store.lunarclient.com/</a></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>
