New Dashboard Notice
Bolt has launched a new Merchant Dashboard experience. See this corresponding page for help documentation that reflects the Legacy Dashboard.
Please note that Legacy Dashboard documentation may no longer have up to date information on our newest features and releases.
Create an order token to initiate the checkout process. This token is used to reference the cart generated in your storefront.
Step 1: Configure Authorization & Headers
- Log in to the Merchant Dashboard.
- Navigate to Developers > API.
- Scroll to Keys and reveal your API Key.
- Embed this Publishable Key on your website. The publishable key is a long string of lower and upper case letters and numbers that consists of three sections.
The Signing Secret found in the Key section must also be used to authenticate payloads sent by Bolt.
|X-Api-Key||Provide the API_KEY|
|X-Nonce||unique 12-16 digit for every request (UUID is a good option)|
|Environment||Bolt API URLs|
Step 2: Make a Create Order Request
Step 1: Call Order Endpoint
See the Official API Reference for a request example.
<?php require(dirname(__FILE__) . '/init_example.php'); $client = new \BoltPay\ApiClient([ 'api_key' => \BoltPay\Bolt::$apiKey, 'is_sandbox' => \BoltPay\Bolt::$isSandboxMode ]); $exampleData = new \BoltPay\Example\Data(); $cartData = $exampleData->generateCart(); /** @var \BoltPay\Http\Response $response */ $response = $client->createOrder($cartData); $orderToken = $response->isResponseSuccessful() ? @$response->getBody()->token : '';
Step 2: Validate the Response
Check for a
HTTP 200 success code and that the response contains an order token.
Ensure that the
order_reference value corresponds to the unique cart ID value provided in the request and that the
cart_url matches as well.
Items & Totals
Ensure the following for each item and its values:
- Items listed in the response must match the items listed in the request
tax_amountmust be in cents
- Every item must have an
(quantity X unit_price) + tax_amount
- Every cent must be precisely accounted for
- You cannot not apply a discount amount that is more than the total order amount. Doing so will result in an error. It is recommended you calculate a max allowable discount amount using the formula line item totals + tax + shipping = max allowable discount