How to Set Up Shipping & Tax Endpoints
Use the Merchant Callback API to handle shipping and tax information for your orders. This is required for multi-step checkout.
How to Use the Shipping & Tax APIs
TIP
Reach out to your CSM to have split shipping and tax enabled for your merchant account.
Shipping API
- Implement the Shipping API endpoint on your server.
- Respond to Bolt’s
order.shipping
POST request from your Merchant Callback API. - Verify the authenticity of the request by confirming that it originated from Bolt.
PHP Example
<?php
require(dirname(__FILE__) . '/init_example.php');
$hmacHeader = @$_SERVER['HTTP_X_BOLT_HMAC_SHA256'];
$signatureVerifier = new \BoltPay\SignatureVerifier(
\BoltPay\Bolt::$signingSecret
);
$requestJson = file_get_contents('php://input');
if (!$signatureVerifier->verifySignature($requestJson, $hmacHeader)) {
throw new Exception("Failed HMAC Authentication");
}
$exampleData = new \BoltPay\Example\Data();
$response = $exampleData->generateShippingOptions();
header('Content-Type: application/json');
http_response_code(200);
echo json_encode($response);
Tax API
The Tax API endpoint is called after a shopper has chosen a shipping option.
- Implement the Tax API endpoint on your server.
- Respond to Bolt’s
order.tax
POST request from your Merchant Callback API. - Verify the authenticity of the request by confirming that it originated from Bolt.
PHP Example
<?php
require(dirname(__FILE__) . '/init_example.php');
$hmacHeader = @$_SERVER['HTTP_X_BOLT_HMAC_SHA256'];
$signatureVerifier = new \BoltPay\SignatureVerifier(
\BoltPay\Bolt::$signingSecret
);
$requestJson = file_get_contents('php://input');
if (!$signatureVerifier->verifySignature($requestJson, $hmacHeader)) {
throw new Exception("Failed HMAC Authentication");
}
$requestJson = file_get_contents('php://input');
$shippingOption = json_decode($requestJson)->shipping_option;
$exampleData = new \BoltPay\Example\Data();
$response = $exampleData->generateTaxOptions($shippingOption);
header('Content-Type: application/json');
http_response_code(200);
echo json_encode($response);
Shipping & Tax API
WARNING
The combined Shipping & Tax endpoint will eventually be deprecated. Bolt recommends using the new, decoupled endpoints for Shipping and Tax.
- Implement the shipping_and_tax Merchant Callback API on your server.
- Respond to Bolt’s
order.shipping_and_tax
POST request from your Merchant Callback API. - Verify the authenticity of the request by confirming that it originated from Bolt.
PHP Example
<?php
require(dirname(__FILE__) . '/init_example.php');
$hmacHeader = @$_SERVER['HTTP_X_BOLT_HMAC_SHA256'];
$signatureVerifier = new \BoltPay\SignatureVerifier(
\BoltPay\Bolt::$signingSecret
);
$requestJson = file_get_contents('php://input');
if (!$signatureVerifier->verifySignature($requestJson, $hmacHeader)) {
throw new Exception("Failed HMAC Authentication");
}
$exampleData = new \BoltPay\Example\Data();
$response = $exampleData->generateShippingTaxOptions();
header('Content-Type: application/json');
http_response_code(200);
echo json_encode($response);
Test the Endpoint
Use the following steps to test your Shipping and Tax API implementation:
- Navigate to your store.
- Open Bolt Checkout, enter an address, then continue to Shipping.
- Bolt should hit your
/shipping_and_tax
endpoint. - The shipping and tax options from your response should appear in the Bolt Checkout modal.
- Bolt should hit your
- Try all shipping options.
- Ensure that the price of shipping and tax on the cart updates accurately.
Errors & Troubleshooting
To respond with specific errors in merchant api responses visit error codes documentation.