For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a Basket

For most stores, you can create a basket without any required parameters. For certain store types you may need to provide additional information.

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.

The returned basket will contain a username_id which can safely be added to the user's session. It is required for use with certain endpoints across Tebex APIs.

Backend Servers

If you are creating a basket on your backend server, you must provide an ip_address on creation, otherwise the basket will be incorrectly attributed to your server's IP.

Universal Stores

No username is required for your basket. Depending on your package Deliverables you may need to provide variable_data per each Package so that it is attributed to the correct user. See Add Package to Basket.

{
  "complete_url": "https://example.tebex.io/thank-you",
  "cancel_url": "https://tebex.io/",
  "custom": {
    "foo": "bar"
  },
  "complete_auto_redirect": true,
  "ip_address": "127.0.0.1"
}

Create a new basket

post

Creates a new basket for use during checkout.

Body
complete_urlstringOptional

A URL the user can return to when checkout is completed.

Example: https://example.tebex.io/thank-you
cancel_urlstringOptional

A URL the user can return to when cancelling checkout.

Example: https://tebex.io/
customobjectOptional

Custom data you wish to associate with the basket. This data will be included with webhook responses and GET requests associated with the Basket.

Example: {"foo":"bar"}
complete_auto_redirectbooleanOptional

True if the user should automatically be redirected to the relevant complete/cancel URL

Example: true
Responses
200

Successful response returns the basket information.

application/json
post/baskets
POST /api/accounts/baskets HTTP/1.1
Host: headless.tebex.io/
Content-Type: application/json
Accept: */*
Content-Length: 139

{
  "complete_url": "https://example.tebex.io/thank-you",
  "cancel_url": "https://tebex.io/",
  "custom": {
    "foo": "bar"
  },
  "complete_auto_redirect": true
}
{
  "data": {
    "id": 244127617,
    "ident": "1a-55fff4107740a1f40d844ff89607557f45bfafb3",
    "complete": false,
    "email": "support@tebex.io",
    "username": null,
    "coupons": [
      {
        "code": "Academy10"
      }
    ],
    "giftcards": [
      {
        "card_number": "0127 0244 7210 1111"
      }
    ],
    "creator_code": "text",
    "cancel_url": "https://tebex.io",
    "complete_url": null,
    "complete_auto_redirect": false,
    "country": "US",
    "ip": "127.0.0.1",
    "username_id": 127244,
    "base_price": 1.27,
    "sales_tax": 0.11,
    "total_price": 1.38,
    "currency": "USD",
    "packages": [
      {
        "id": 1,
        "description": "100 coins added to your character",
        "image": "https://tebex.io/path/to/image.png",
        "name": "100 Coins",
        "slug": "100-coins",
        "in_basket": {
          "quantity": 2,
          "price": 1,
          "gift_username_id": "text",
          "gift_username": "text"
        },
        "type": "single",
        "revenue_share": [
          {
            "wallet_ref": "some_wallet_reference",
            "amount": 0.5,
            "gateway_fee_percent": 50
          }
        ]
      }
    ],
    "custom": {
      "foo": "bar",
      "ref": 1234
    },
    "links": {
      "payment": "https://checkout.tebex.io/api/payments/tbx-12345",
      "checkout": "https://checkout.tebex.io/checkout/1a-55fff4107740a1f40d844ff89607557f45bfafb3"
    }
  }
}

Last updated