Endpoints
Important Update
We want to inform you about upcoming changes to our API that we're releasing on the 1st April 2024. Please be aware that these changes might impact your integration and may require updates to your existing codebase. The following JSON properties in the Basket resource are being removed:
recurring
recurringPeriod
recurringNextPaymentDate
These properties will be moved within Basket Rows (i.e. the individual products/package):
recurring
recurring_period
recurring_next_payment_date
Our API documentation below has been updated to reflect this, please see Fetch a basket by its identifier for an example.
Baskets
Create a basket that can be used to pay for items
POST
https://checkout.tebex.io/api/baskets
Request Body
Name | Type | Description |
---|---|---|
return_url* | String | URL the customer can return to when clicking ‘return to ACCOUNTNAME' |
complete_url* | String | URL the customer can return to after completing their payment |
custom | Object | Free-form object allowing custom data to be passed through the request - this will be returned as is as part of webhooks post completion |
first_name | String | First name of the customer to checkout |
last_name | String | Last name of the customer to checkout |
String | Email address of the customer to checkout | |
expires_at | Date - ISO8601 | The expiry time of the basket, the customer won't be able to purchase the basket once it has expired |
complete_auto_redirect | Boolean | Automatically redirect to the complete_url provided above |
country | String | The ISO 3166-1 alpha-2 code of the customer's country, e.g. |
creator_code | String | The creator code that should automatically be applied to this basket |
Fetch a basket by its identifier
GET
https://checkout.tebex.io/api/baskets/{ident}
Path Parameters
Name | Type | Description |
---|---|---|
ident* | String | The ident for this basket (provided upon creation) |
NB: The links.payment
property is only returned if the basket has been paid for and a payment exists with the complete/refund/chargeback status.
The links.checkout
property is only returned if the basket has not been paid, and is the URL to send the customer to to make payment
Add package to a basket
POST
https://checkout.tebex.io/api/baskets/{ident}/packages
This endpoint requires prior approval - please contact your account manager.
Path Parameters
Name | Type | Description |
---|---|---|
ident* | String | The ident for this basket (provided upon creation) |
Request Body
Name | Type | Description |
---|---|---|
package* | Object | Object describing the product to be added to the basket |
package.name* | String | The name of the item being purchased(shown to the customer on checkout in and in their email receipt) |
package.price* | Float | A float (decimal) value representingthe price of the package in your account currency |
package.expiry_period | Enum | The renewal period for this item (required for subscription purchases). Allowed values: day, month, year |
package.expiry_length | Integer | An integer representing the number of |
package.metaData | Object | A sub-object to hold seller-specific properties related to the item (must be pre-agreed with Tebex) |
package.metaData.custom | String | A free-text string field that is passed back to you via the webhook (for example a tracking ID) |
qty | Integer | Number of package to add to basket (default: 1) |
type* | Enum | The type of payment. Allowed values: single (one time payment), subscription (recurring payment) |
revenue_share | Array | An array of payment destination objects describing how the purchase should be split between multiple wallets. NB: This is only available with pre-agreement from Tebex |
revenue_share[].wallet_ref | String | The reference of the wallet that should be credited |
revenue_share[].amount | Float | A float (decimal) value representing the amount of this payment in your account currency that should be credited |
revenue_share[].gateway_fee_percent | Float | A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0-100 |
Remove a row from the basket
DELETE
https://checkout.tebex.io/api/baskets/{ident}/packages/{row.id}
Path Parameters
Name | Type | Description |
---|---|---|
ident* | String | The ident for this basket (provided upon creation) |
row.id* | Integer | The |
Add a sale to the basket
POST
https://checkout.tebex.io/api/baskets/{ident}/sales
NB: Sales cannot be applied to baskets with revenue_share
set.
Path Parameters
Name | Type | Description |
---|---|---|
ident* | String | The ident for this basket (provided upon creation) |
Request Body
Name | Type | Description |
---|---|---|
name* | String | The name of the sale (displayed to the customer) |
discount_type* | Enum | The type of discount. Allowed values:
|
amount* | Float | The amount or percentage to deduct |
Create a checkout request
POST
https://checkout.tebex.io/api/checkout
This API call essentially allows all the above calls (create basket, add items, add sale) to be made in a single API call, for when the Seller is managing the basket locally. For field definitions, see above API calls.
This endpoint requires prior approval - please contact your account manager.
Request Body
Name | Type | Description |
---|---|---|
basket* | Object | An object representing the |
basket.return_url* | String | |
basket.complete_url* | String | |
basket.custom | Object | |
items* | Array | An array of items to be added to the basket |
items[].package* | Object | |
items[].package.name* | String | |
items[].package.price* | Float | |
items[].package.expiry_period | Enum | |
items[].package.expiry_length | Integer | |
items[].package.metaData | Object | |
items[].package.metaData.custom | String | |
items[].qty | Integer | |
items[].type* | Enum | |
items[].revenue_share | Array | |
items[].revenue_share[].wallet_ref | String | |
items[].revenue_share[].amount | Float | |
items[].revenue_share[].gateway_fee_percent | Float | |
sale | Object | An object representing the Sale portion of the request |
sale.name | String | |
sale.discount_type | Enum | |
sale.amount | Float | |
basket.first_name | String | |
basket.last_name | String | |
basket.email | String | |
expires_at | Date - ISO8601 |
Payments
Fetch a payment by its transaction ID
GET
https://checkout.tebex.io/api/payments/{txnId}?type=txn_id
Path Parameters
Name | Type | Description |
---|---|---|
txnId* | String | The transaction ID for the payment (starts tbx-) |
Refund a payment by its transaction ID
POST
https://checkout.tebex.io/api/payments/{txnId}/refund?type=txn_id
Path Parameters
Name | Type | Description |
---|---|---|
txnId* | String | The transaction ID for the payment (starts tbx-) |
Recurring Payments
Fetch a recurring payment (subscription) by its reference
GET
https://checkout.tebex.io/api/recurring-payments/{reference}
Path Parameters
Name | Type | Description |
---|---|---|
reference* | String | The reference for the recurring payment (starts tbx-r-) |
Update a subscription with a new product / amount to pay - replacing the existing product
PUT
https://checkout.tebex.io/api/recurring-payments/{reference}
If the new subscription amount is higher than the existing amount, a pro-rata charge will be made to cover the cost of the new price up until the next billing date.
This endpoint requires prior approval - please contact your account manager.
Path Parameters
Name | Type | Description |
---|---|---|
reference* | String | The reference for the recurring payment (starts tbx-r-) |
Request Body
Name | Type | Description |
---|---|---|
items* | Array | An array containing the item to be added to the recurring payment. (Only 1 item is supported at this time) |
items[].package* | Object | |
items[].package.name* | String | |
items[].package.price* | Float | |
items[].package.expiry_period* | Enum | |
items[].package.expiry_length* | Enum | |
items[].package.metaData | Object | |
items[].package.metaData.custom | String | |
items[].type* | String | Must be 'subscription' |
items[].revenue_share | Array | |
items[].revenue_share[].wallet_ref | String | |
items[].revenue_share[].amount | Float | |
items[].revenue_share[].gateway_fee_percent | Float |
Pause or reactivate a recurring payment
PUT
/recurring-payments/{reference}/status
Path Parameters
Name | Type | Description |
---|---|---|
reference* | String | The reference for the recurring payment (starts tbx-r-) |
Request Body
Name | Type | Description |
---|---|---|
status* | Enum | Allowed values:
|
paused_until | Date - ISO8601 | If pausing a recurring payment, optionally provide the date that the recurring payment should automatically be reactivated. |
Cancel a recurring payment
DELETE
https://checkout.tebex.io/api/recurring-payments/{reference}
Path Parameters
Name | Type | Description |
---|---|---|
reference* | String | The reference for the recurring payment (starts tbx-r-) |
Last updated