Aller au contenu principal

Calculating Tax and Shipping for Shoppable Ads

Required for: API, CSV, URL, SFTP, EDI Catalog integration methods

When a shopper purchases your product through a Shoppable Ad, Rokt orchestrates the order in real time. Before the order is placed, Rokt calls your APIs to retrieve the applicable shipping rates (if desired) and tax amounts (required). Once the order is confirmed, Rokt delivers it to you via webhook for fulfillment.

The order flow for Rokt Shoppable Ads proceeds as follows:

  1. Shopper selects a product and initiates checkout.
  2. Rokt calls your endpoint to fetch available shipping cost and to calculate applicable tax.
  3. Shopper completes payment using secure payment forwarding with you as MoR.
  4. Rokt Catalog sends you an order with full order details.
  5. You fulfill the order and send tracking information back.

AuthenticationLien direct vers Authentication

All API endpoints require the following authentication headers on every request:

Header NameTypeRequiredDescription
x-api-keystringYesAPI key provided during onboarding
x-api-secretstringYesAPI secret provided during onboarding
Content-TypestringYesMust be application/json

Shipping Rate APILien direct vers Shipping Rate API

By default, Shipping values can be set via Rokt Catalog for Brands as a flat rate for Shoppable Ads. We highly recommend offering free shipping ($0.00) as it is a strong incentive for conversion in placement. This can be set directly in Rokt Catalog for Brands.

If you want your shipping rates to be dynamic, you must expose and host this endpoint. Rokt calls your Shipping Rate endpoint during checkout to present real-time shipping options to the shopper. Provide the URL to your Rokt account manager during onboarding.


Request (Rokt → Your endpoint)Lien direct vers Request (Rokt → Your endpoint)

Rokt sends a request to your Shipping Rate URL with the following payload:

Request BodyLien direct vers Request Body

Field NameTypeRequiredDescription
originobjectYesWarehouse/origin address
destinationobjectYesShopper destination address
productsarrayYesArray of SKU and quantity
currencystringNoCurrency code, defaults to USD

origin / destination ObjectLien direct vers origin / destination Object

Field NameTypeRequiredDescription
address1stringYesPrimary street address
address2string | nullNoSecondary address line
citystringYesCity
stateCodestringYesState or province code (e.g. TX)
postalCodestringYesZIP or postal code
countrystringYesCountry code (e.g. US)

products Array ItemLien direct vers products Array Item

Field NameTypeRequiredDescription
skustringYesProduct SKU
quantityintegerYesQuantity ordered

Example RequestLien direct vers Example Request

Rokt sends a POST to your Shipping Rate URL (for example https://api.yourbrand.com/rokt/shipping-rates) with the following payload:

{
"origin": {
"address1": "123 Warehouse St",
"address2": null,
"city": "Memphis",
"stateCode": "TN",
"postalCode": "38101",
"country": "US"
},
"destination": {
"address1": "456 Shopper Ave",
"address2": null,
"city": "Austin",
"stateCode": "TX",
"postalCode": "78701",
"country": "US"
},
"products": [
{
"sku": "SHOE-8-BLK",
"quantity": 1
}
],
"currency": "USD"
}

Response (Your endpoint → Rokt)Lien direct vers Response (Your endpoint → Rokt)

Return an array of the selected shipping rate. Rokt presents this option to the shopper at checkout:

Response BodyLien direct vers Response Body

Field NameTypeDescription
ratesarrayArray of shipping rate options
rates[].service_namestringDisplay name (e.g. Standard Shipping)
rates[].service_codestringInternal code (e.g. STANDARD)
rates[].total_pricenumberShipping cost in decimal dollars (e.g. 7.99)
rates[].currencystringCurrency code
rates[].min_delivery_datestringEarliest delivery date (YYYY-MM-DD)
rates[].max_delivery_datestringLatest delivery date (YYYY-MM-DD)
successbooleantrue if rates returned successfully
errorMessagestringPresent only on failure

Example ResponseLien direct vers Example Response

{
"rates": [
{
"service_name": "Standard Shipping",
"service_code": "STANDARD",
"total_price": 7.99,
"currency": "USD",
"min_delivery_date": "2026-03-24",
"max_delivery_date": "2026-03-27"
}
],
"success": true
}
info

Prices are in decimal dollars. total_price values must be expressed as decimal numbers (e.g. 7.99 = $7.99).


Error ResponsesLien direct vers Error Responses

HTTP CodesuccesserrorMessage
200falseProduct {sku} is not available.
401falseUnauthorized: Invalid API key
400falseBad Request: products is missing.
400falseBad Request: shippingAddress is missing.
500falseUnexpected error: if the error persists, please contact an administrator.


Tax APILien direct vers Tax API

You must expose and host this endpoint. Rokt calls your Tax endpoint during checkout to calculate the applicable tax for the order. Provide the URL to your Rokt account manager during onboarding.


Request (Rokt → Your endpoint)Lien direct vers Request (Rokt → Your endpoint)

Request BodyLien direct vers Request Body

Field NameTypeRequiredDescription
productsarrayYesArray of SKU and quantity
shippingAddressobjectYesShipping destination address

shippingAddress ObjectLien direct vers shippingAddress Object

Field NameTypeRequiredDescription
address1stringYesPrimary street address
address2string | nullNoSecondary address line
citystringYesCity
stateCodestringYesState or province code (e.g. TX)
postalCodestringYesZIP or postal code

products Array ItemLien direct vers products Array Item

Field NameTypeRequiredDescription
skustringYesProduct SKU
quantityintegerYesQuantity ordered

Example RequestLien direct vers Example Request

Rokt sends a POST to your Tax URL (for example https://api.yourbrand.com/rokt/tax) with the following payload:

{
"products": [
{
"sku": "SHOE-8-BLK",
"quantity": 1
}
],
"shippingAddress": {
"address1": "456 Shopper Ave",
"city": "Austin",
"stateCode": "TX",
"postalCode": "78701"
}
}

Response (Your endpoint → Rokt)Lien direct vers Response (Your endpoint → Rokt)

Response BodyLien direct vers Response Body

Field NameTypeDescription
successbooleantrue if tax calculated successfully
taxarrayPer-product tax breakdown
tax[].productIdstringSKU or product identifier
tax[].taxRatenumberTax rate as decimal (e.g. 0.0775 = 7.75%)
tax[].taxAmountnumberTax amount in decimal dollars (e.g. 2.44)
taxTotalnumberTotal tax across all products in decimal dollars
errorMessagestringPresent only on failure

Example ResponseLien direct vers Example Response

{
"success": true,
"tax": [
{
"productId": "SHOE-8-BLK",
"taxRate": 0.0625,
"taxAmount": 8.12
}
],
"taxTotal": 8.12
}
info

Tax amounts are in decimal dollars. Consistent with the Shipping Rate API, taxAmount and taxTotal must be expressed as decimal numbers (e.g. 8.12 = $8.12), and taxRate as a decimal fraction (e.g. 0.0625 = 6.25%).


Error ResponsesLien direct vers Error Responses

HTTP CodesuccesserrorMessage
200falseProduct {sku} is not available.
401falseUnauthorized: Invalid API key
400falseBad Request: products is missing.
400falseBad Request: shippingAddress is missing.
500falseUnexpected error: if the error persists, please contact an administrator.
Cet article vous a-t-il été utile ?