Skip to main content

Basket Details

TransactDirect supports flexible basket details through the Payments API and Checkout Page.

The Basket should be construted using the JSON format described in this article and then Base64 encoded and sent along with the payment request in the Basket field.

Basket Format

The Basket JSON object is made up of the following elements

Field NameDescriptionReq'd
itemsProvides a list of all items in the basket. See Item Object.M
discountsProvides a list any discounts applied to the basket. See Discount Object.O
taxesProvides a list of taxes applied to the basket. See Tax Object.O
deliveryProvides delivery details. See Delivery Object.O

Item Object

Field NameDescriptionReq'dType
skuThe stock code for this product.OA
descriptionThe product description for this item.MA
quantityThe quantity of this item on this order line.MN
unitPriceThe unit price for this product in major currency. e.g. 3.99MN
totalThe total price for this order line. If not supplied it will be calculated automatically.ON

Note: All items should be supplied with their unit price inclusive of any taxes and excluding any discounts.

Discount Object

Field NameDescriptionReq'dType
codeThe discount code.OA
descriptionThe description for this discount.MA
amountThe amount of discount in major currency. e.g. 1.99MN

Tax Object

Note: All taxes are displayed against the total basket price, all basket items should be supplied inclusive of any taxes.

Field NameDescriptionReq'dType
codeThe tax code.OA
descriptionDescription of this tax item.MA
rateThe rate at which this tax item is applied.ON
amountThe amount of tax applied in major currency. e.g. 2.50MN

Delivery Object

Field NameDescriptionReq'dType
carrierThe carrier used for deliveryMA
trackingReferenceThe tracking reference number for this deliveryOA
trackingUrlThe URL that can be used to obtain tracking information for this deliveryOA
amountThe cost for this delivery in major currency. e.g. 2.50MN

Character Encoding

To ensure correct display on the Checkout Page, some characters should be encoded.

CharacterDescriptionEncoding
£Pound symbol\u00A3
Trademark symbol\u2122

Request Sample

Basket in JSON format

The following is a sample of a JSON structured basket and the Base64 encoded version that would be passed to TransactDirect in the Basket field.

{
"items": [
{
"sku": "THING001",
"description": "3for2 Things",
"quantity": 3,
"unitPrice": 6.99,
"total": 20.97
},
{
"sku": "POUND001",
"description": "Pound shop items",
"quantity": 1,
"unitPrice": 0.99,
"total": 0.99
}
],
"discounts": [
{
"code": "3FOR2",
"description": "3 for 2",
"amount": 6.99
},
{
"code": "JANPROMO5",
"description": "January Promo, \u00A35 off",
"amount": 5.00
}
],
"taxes": [
{
"code": "VAT",
"description": "VAT",
"rate": 0.20,
"amount": 1.99
}
],
"delivery": {
"carrier": "Royal Mail Tracked 48\u2122",
"amount": 1.99
}
}

Basket encoded to Base64

eyJpdGVtcyI6W3sic2t1IjoiVEhJTkcwMDEiLCJkZXNjcmlwdGlvbiI6IjNmb3I
yIFRoaW5ncyIsInF1YW50aXR5IjozLCJ1bml0UHJpY2UiOjYuOTksInRvdGFsIj
oyMC45N30seyJza3UiOiJQT1VORDAwMSIsImRlc2NyaXB0aW9uIjoiUG91bmQgc
2hvcCBpdGVtcyIsInF1YW50aXR5IjoxLCJ1bml0UHJpY2UiOjAuOTksInRvdGFs
IjowLjk5fV0sImRpc2NvdW50cyI6W3siY29kZSI6IjNGT1IyIiwiZGVzY3JpcHR
pb24iOiIzIGZvciAyIiwiYW1vdW50Ijo2Ljk5fSx7ImNvZGUiOiJKQU5QUk9NTz
UiLCJkZXNjcmlwdGlvbiI6IkphbnVhcnkgUHJvbW8sIFx1MDBBMzUgb2ZmIiwiY
W1vdW50Ijo1fV0sInRheGVzIjpbeyJjb2RlIjoiVkFUIiwiZGVzY3JpcHRpb24i
OiJWQVQiLCJyYXRlIjowLjIsImFtb3VudCI6MS45OX1dLCJkZWxpdmVyeSI6eyJ
jYXJyaWVyIjoiUm95YWwgTWFpbCBUcmFja2VkIDQ4XHUyMTIyIiwiYW1vdW50Ij
oxLjk5fX0=