LogoLogo
  • Welcome
  • Getting Started
  • Integration Methods
  • SDKs
  • Tebex for Unreal Engine 5
  • Tebex for Unity Engine
  • Webstore Builder
    • Overview
    • Getting Started
    • Twig
      • Tags
      • Filters
      • Functions
    • Global Variables
      • basket
      • store
      • page
    • Pages
      • index.html
      • checkout.html
      • username.html
      • options.html
      • package.html
      • cms/page.html
      • category.html
      • layout.html
    • Sidebar Modules
      • module.communitygoal.html
      • module.featuredpackage.html
      • module.giftcardbalance.html
      • module.goal.html
      • module.payments.html
      • module.serverstatus.html
      • module.textbox.html
      • module.topdonator.html
    • Assets
    • Schema
    • Developer Plan
    • Footer
    • Guides
      • Package Slugs
  • Headless API
    • Overview
    • Getting Your Listings
    • Creating a Basket
    • Adding Packages
    • Gifting Packages
    • Applying Discounts / Creator Codes
    • Directing to Checkout
    • Endpoints
    • Postman Config
    • Example Integration
  • Checkout API
    • Overview
    • Headers and Authentication
    • Start the Checkout Process
    • Checkout Webhooks
    • Endpoints
    • Errors
    • Postman Config
  • Tebex.js
    • Overview
    • Integration
    • Events
    • Web Components
    • Custom Render Location
    • NPM
    • GitHub
  • Webhooks
    • Overview
    • Login Webhooks
  • Game Server API
    • Overview
    • Authentication
    • Error Handling
    • Endpoints
  • Affiliate API
    • Overview
    • Referrals
    • Game Types
    • Webhooks
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Headless API

Applying Discounts / Creator Codes

PreviousGifting PackagesNextDirecting to Checkout

Last updated 11 months ago

Was this helpful?

If offered by your store, you can apply coupons, gift cards, and creator codes via Headless API once a basket has been created and the user's desired packages have been added.

Depending on the store's configuration, multiple gift cards or coupons may be applied. To remove a gift card or coupon, use the relevant /remove endpoint.

Remove a coupon from the basket.

post

Removes a coupon code from a basket

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Responses
200
Successful response.
422
The provided request is invalid. The error response will include detail as to which parameter failed validation.
post
POST /api/accounts/{token}/baskets/{basketIdent}/coupons/remove HTTP/1.1
Host: headless.tebex.io
Accept: */*

No content

  • POSTApply a creator code to a basket.
  • POSTRemove a creator code from the basket.
  • POSTApply a gift card to a basket.
  • POSTRemove a gift card from the basket.
  • POSTApply a coupon to a basket.
  • POSTRemove a coupon from the basket.

Remove a creator code from the basket.

post

Applies a creator code to a basket.

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Responses
200
Creator code removed successfully.
422
The provided request is invalid. The error response will include detail as to which parameter failed validation.
post
POST /api/accounts/{token}/baskets/{basketIdent}/creator-codes/remove HTTP/1.1
Host: headless.tebex.io
Accept: */*

No content

Apply a creator code to a basket.

post

Applies a creator code to a basket.

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Body
creator_codestringOptionalExample: Academy10
Responses
200
Successful response returns the basket.
application/json
422
The provided request is invalid. The error response will include detail as to which parameter failed validation.
post
POST /api/accounts/{token}/baskets/{basketIdent}/creator-codes HTTP/1.1
Host: headless.tebex.io
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "creator_code": "Academy10"
}
{
  "data": {
    "id": 244127617,
    "ident": "1a-55fff4107740a1f40d844ff89607557f45bfafb3",
    "complete": false,
    "email": "support@tebex.io",
    "username": null,
    "coupons": [
      {
        "coupon_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": [
      {
        "qty": 2,
        "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"
    }
  }
}

Apply a gift card to a basket.

post

Applies a creator code to a basket.

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Body
card_numberstringOptionalExample: 0127 0244 7210 1111
Responses
200
Successful response returns the basket.
application/json
post
POST /api/accounts/{token}/baskets/{basketIdent}/giftcards HTTP/1.1
Host: headless.tebex.io
Content-Type: application/json
Accept: */*
Content-Length: 37

{
  "card_number": "0127 0244 7210 1111"
}
200

Successful response returns the basket.

{
  "data": {
    "id": 244127617,
    "ident": "1a-55fff4107740a1f40d844ff89607557f45bfafb3",
    "complete": false,
    "email": "support@tebex.io",
    "username": null,
    "coupons": [
      {
        "coupon_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": [
      {
        "qty": 2,
        "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"
    }
  }
}

Remove a gift card from the basket.

post

Removes a gift card from the basket.

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Body
card_numberstringOptionalExample: 0127 0244 7210 1111
Responses
200
Gift card removed successfully.
422
The provided request is invalid. The error response will include detail as to which parameter failed validation.
post
POST /api/accounts/{token}/baskets/{basketIdent}/giftcards/remove HTTP/1.1
Host: headless.tebex.io
Content-Type: application/json
Accept: */*
Content-Length: 37

{
  "card_number": "0127 0244 7210 1111"
}

No content

Apply a coupon to a basket.

post

Applies a creator code to a basket.

Path parameters
tokenstringRequired

The webstore identifier.

Example: t66x-7cd928b1e9312709e6810edac6dc1fd1eefc57cb
basketIdentstringRequired

The basket identifier.

Example: c00244-d2ac2e77418a55b25292a6bc7a719ad9c529ba2c
Body
coupon_codestringOptionalExample: Academy10
Responses
200
Successful response returns the basket.
application/json
post
POST /api/accounts/{token}/baskets/{basketIdent}/coupons HTTP/1.1
Host: headless.tebex.io
Content-Type: application/json
Accept: */*
Content-Length: 27

{
  "coupon_code": "Academy10"
}
200

Successful response returns the basket.

{
  "data": {
    "id": 244127617,
    "ident": "1a-55fff4107740a1f40d844ff89607557f45bfafb3",
    "complete": false,
    "email": "support@tebex.io",
    "username": null,
    "coupons": [
      {
        "coupon_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": [
      {
        "qty": 2,
        "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"
    }
  }
}