
Hello Tebex Team,
I hope this message finds you well. I have a few suggestions regarding the Headless API that I believe could enhance its functionality and usability.
GET Basket Endpoint:
In the current implementation of the GET Basket endpoint, the selected variables (such as selected server and other user choices) are not returned. Including these variables in the response would provide a more complete and useful data set for developers.
Endpoint: {{baseUrl}}/api/accounts/:webstoreIdentifier/baskets/:basketIdent
Current Response Example:
{
"data": {
"ident": "xx-xxxx",
"complete": false,
"id": 111,
"country": "GB",
"ip": "1.2.3.4",
"username_id": "xxxx",
"username": "demo",
"base_price": 1.5,
"sales_tax": 0.3,
"total_price": 1.8,
"packages": [
{
"id": 111,
"name": "Test Package",
"description": "<p>This is a test package.</p>",
"in_basket": {
"quantity": 1,
"price": 1.5,
"gift_username_id": null,
"gift_username": null
}
}
],
"coupons": [
{
"code": "TEST-COUPON-CODE"
}
],
"giftcards": [
{
"card_number": 1234123412341234
}
],
"creator_code": "test-code-creator",
"links": {
"checkout": "https://checkout.tebex.io/checkout/xx-xxxx"
}
}
}Suggested Improvement: Include the selected variables related to user choices, such as the selected server and other options. For example, if a user wants to purchase a gift card and needs to review their entered email, the email should be included in the response.
To illustrate, the variables object could look similar to this example from the endpoint {{baseUrl}}/api/accounts/:webstoreIdentifier/packages/:packageId, but instead of showing all variables, it should show only the selected variables with the ID, name, and value:
{
"data": {
"id": 5571647,
"name": "Mvp",
"description": "<p>Mvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp PackageMvp Package</p>",
"image": "https://dunb17ur4ymx4.cloudfront.net/packages/images/f787a29376c047054358c265cb5cf2126373b72f.png",
"type": "single",
"category": {
"id": 2345670,
"name": "Global Ranks"
},
"base_price": 49.99,
"sales_tax": 0,
"total_price": 49.99,
"currency": "USD",
"discount": 0,
"variables": [
{
"id": 44184,
"identifier": "Test",
"value": "User input value"
},
{
"id": 49410,
"identifier": "DropdownVars",
"value": "testval2"
}
],
"disable_quantity": false,
"disable_gifting": false,
"expiration_date": null,
"created_at": null,
"updated_at": "2024-03-30T22:19:28+00:00"
}
}Gift Cards:
It would be beneficial to return the value used from a gift card in the response. For example, if an order total is $100 and a $150 gift card is applied, only $100 of the gift card value is used. Including the value used in the gift cards object would enhance clarity and usability.
Coupons:
Additionally, returning the discount amount or percentage for coupons would be helpful. This information could be displayed on the checkout page or in a basket sidebar. These details are already available in the default Twig templates, so exposing them via the API would be consistent and useful.
By including the gift card amount used and the coupon discount details in the API response, developers can create a more informative and user-friendly checkout experience.
Thank you for considering these suggestions. I believe these enhancements would significantly improve the Headless API’s functionality.
Best regards,
TripleZone