latestOpenAPI 3.0.3MIT2026-08-10121945.1 KB

a52c87b9a2b9

Baskets

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

post/baskets

Request body

return_urlstring

The URL a customer can return to without completing checkout

complete_urlstring

URL the customer can return to after completing payment

customobject

Any custom data to be passed through the request. This will be returned in a post-completion webhook.

first_namestring

The first name of the customer

last_namestring

The last name of the customer

emailstring

The email address of the customer

expires_atstring

An ISO8601 formatted date. After this date the basket cannot be used to checkout.

complete_auto_redirectboolean

Automatically redirect to the complete_url provided

countrystring

An ISO 3166-1 alpha-2 character code representing the customer's country.

creator_codestring

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

ipstring

The IP address of the customer using this basket. Provide the IP if creating a basket on your server backend.

Example request

{
  "return_url": "https://example.tebex.io/",
  "complete_url": "https://example.tebex.io/complete",
  "custom": {
    "foo": "bar"
  },
  "first_name": "Neil",
  "last_name": "McNeil",
  "email": "example@tebex.io",
  "expires_at": "2025-01-27T18:09:51Z",
  "complete_auto_redirect": true,
  "country": "US",
  "ip": "1.2.3.4"
}

Response

Basket created successfully

identstring
expirestring
pricenumber float
isPaymentMethodUpdateboolean
returnUrlstring nullable
completeboolean
taxnumber
usernamestring nullable
discountsDiscount[]
couponsCoupon[]
giftcardsGiftCard[]
fingerprintstring nullable

Browser fingerprint to identify the user

creator_codestring

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

roundupboolean nullable
cancel_urlstring
complete_urlstring nullable
complete_auto_redirectboolean
customobject nullable

Example response

{
  "ident": "1a-55fff4107740a1f40d844ff89607557f45bfafb3",
  "expire": "2022-10-25 15:15:40",
  "price": 1.27,
  "priceDetails": {
    "fullPrice": 1.4,
    "subTotal": 1.27,
    "discounts": [],
    "total": 1.4,
    "surcharges": [],
    "tax": 0.13,
    "balance": 0,
    "sales": [],
    "giftcards": [],
    "roundUp": null
  },
  "address": {
    "name": "Ted Tebex",
    "first_name": "Ted",
    "last_name": "Tebex",
    "address": "37 Broadhurst Gardens, London, United Kingdom, NW6 3QT",
    "email": "example@tebex.io",
    "state_id": null,
    "country": "UK",
    "postal_code": "NW6 3QT"
  },
  "rows": [
    {
      "id": 173125385,
      "basket": 725572301,
      "quantity": 2,
      "price": 1.27,
      "meta": {
        "name": "1000 Gold",
        "rowprice": 2.54,
        "initialprice": 1.27,
        "requiredPackages": [],
        "allowsGiftCards": true,
        "servers": [],
        "deliverableTypes": [],
        "hasSellerProtection": true,
        "revenue_share": [],
        "realprice": 1.27
      }
    }
  ],
  "cancel_url": "https://tebex.io",
  "custom": {
    "foo": "bar",
    "ref": 1234
  },
  "links": {
    "payment": "https://checkout.tebex.io/api/payments/tbx-12345",
    "checkout": "https://checkout.tebex.io/checkout/1a-55fff4107740a1f40d844ff89607557f45bfafb3"
  }
}