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

Add Package to Basket

To add a package, you must provide the package_id and the desired quantity of that package.

If your store uses Dynamic Categories, and the package you're adding is dynamic, then dynamic must be set to true or the request will fail.

Modifying package quantities after adding requires authentication. See Authorize a Basket

Add package to basket

post

Add a package with the given ID to the basket.

To add a package belonging to a dynamic category, set dynamic to true. Without this property the API will treat the request as a normal package ID.

Path parameters
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Body
package_idstringOptionalExample: 6276316
quantityintegerOptionalExample: 1
dynamicbooleanOptional

Set to true when adding a package that belongs to a dynamic category. When omitted, the API acts as if a normal package ID was provided.

Example: true
Responses
200

Successful response.

application/json
idstringOptionalExample: 244127617
identstringOptionalExample: 1a-55fff4107740a1f40d844ff89607557f45bfafb3
completebooleanOptionalExample: false
emailstring · nullableOptionalExample: support@tebex.io
usernamestring · nullableOptional
creator_codestringOptional

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

cancel_urlstringOptionalExample: https://tebex.io
complete_urlstring · nullableOptional
complete_auto_redirectbooleanOptionalExample: false
countrystringOptional

A two-character country code

Example: US
ipstringOptionalExample: 127.0.0.1
username_idintegerOptionalExample: 127244
base_pricenumber · floatOptionalExample: 1.27
sales_taxnumber · floatOptionalExample: 0.11
total_pricenumber · floatOptionalExample: 1.38
currencystringOptional

A 3 character currency code

Example: USD
customobject · nullableOptionalExample: {"foo":"bar","ref":1234}
post/{basketIdent}/packages
POST /api/baskets/{basketIdent}/packages HTTP/1.1
Host: headless.tebex.io
Content-Type: application/json
Accept: */*
Content-Length: 50

{
  "package_id": 6276316,
  "quantity": 1,
  "dynamic": true
}
{
  "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