# Creating a Basket

Depending on the type of Tebex store you are integrating, additional parameters may be necessary before the basket can be successfully created.

## Authorizing Baskets

For most stores, the user must authorize their account before checkout is completed. This is done via the **/auth** endpoint where we will return the authentication options available for your store.&#x20;

Provide a `returnUrl` , and after successful authentication the user will be directed back to your site.

{% openapi src="<https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media&token=62e71089-ed13-428f-828e-d0f3eeee20b9>" path="/accounts/{token}/baskets/{basketIdent}/auth?returnUrl={returnUrl}" method="get" %}
[headless-api.yaml](https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media\&token=62e71089-ed13-428f-828e-d0f3eeee20b9)
{% endopenapi %}

## Minecraft and Overwolf Stores

You must provide the `username` parameter as part of the basket creation request so that the basket is attributed to the correct user:

{% hint style="warning" %}
If you are creating a basket on your **backend server**, you will need to provide us the `ip_address` of the customer.

Currently we are unable to support IPv6 addresses being provided in the `ip_address` property. While we work on enabling IPv6 support, please provide an IPv4 address for the customer.<br>

If you are creating a basket from the user's **browser**, we will automatically determine the IP from the requesting device.
{% endhint %}

```javascript
{
  "complete_url": "https://example.tebex.io/thank-you",
  "cancel_url": "https://tebex.io/",
  "custom": {
    "foo": "bar"
  },
  "complete_auto_redirect": true,
  "username": "TebexDev",
}
```

The `Basket` which is returned will include the `username_id` which may be required for certain endpoints.&#x20;

You should save the **username\_id** as part of the user's session for use later.

## Universal Stores

No `username` is required, but depending on your package **Deliverables** you may need to provide `variable_data` so that the package is attributed to the correct user. See [**Adding Packages**](https://docs.tebex.io/developers/headless-api/adding-packages)**.**

{% openapi src="<https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media&token=62e71089-ed13-428f-828e-d0f3eeee20b9>" path="/accounts/{token}/baskets" method="post" %}
[headless-api.yaml](https://924803319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaRz9HUAxrYuZsSDWhYnu%2Fuploads%2F7Z5I0T5QbbgoGzyObgml%2Fheadless-api.yaml?alt=media\&token=62e71089-ed13-428f-828e-d0f3eeee20b9)
{% endopenapi %}
