📍 Bolt Help / Developers / Developer Guides / Checkout Setup / Managed Checkout Setup / Custom Cart Checkout / Bolt Checkout Direct API Integration Guide

Bolt Checkout Direct API Integration Guide

Use this guide to set up a direct API Bolt Checkout flow on your website using our PHP library.

Pre-requisites

You must have a Bolt Merchant account to begin. If you do not yet have an account, contact sales to begin onboarding.

API Keys

You must have access to your merchant account’s production and sandbox keys to set up this integration. Both admin and developer-level roles have access to keys; if you are a developer and you do not have access, reach out to your Bolt Admin.

  1. Login to the Merchant Dashboard.
  2. Navigate to Developers > API.
  3. Scroll to Keys.
  4. Select Click to Reveal

The Publishable Key supports the multi-step checkout use case by default. To build other checkout flows such as Payment-Only, switch divisions using the Division dropdown.

Environments

You must have all of the following merchant accounts set up to build, test, and deploy your integration:

Never share your API Keys or Signing Secrets externally.

PHP Examples

Use your API keys and environment URLs to set up your config.php and init_example.php configurations. The following examples can be downloaded from our PHP library.

config.php

<?php

return [
    'API_KEY' => '{{YOUR_API_KEY}}',
    'IS_SANDBOX' => true,
    'AUTH_CAPTURE' => true,
    'SIGNING_SECRET' => '{{YOUR_SIGNING_SECRET}}',
    'PUBLISHABLE_KEY' => '{{YOUR_PUBLISHABLE_KEY}}',
    'PUBLISHABLE_KEY_PAYMENT_ONLY' => '{{YOUR_PAYMENT_ONLY_DIVISION_PUBLISHABLE_KEY}}',
    'CONNECT_SANDBOX_BASE' => 'https://connect-sandbox.bolt.com',
    'CONNECT_PRODUCTION_BASE' => 'https://connect.bolt.com',
    'API_SANDBOX_URL' => 'https://api-sandbox.bolt.com',
    'API_PRODUCTION_URL' => 'https://api.bolt.com'
];

init_example.php

<?php
require(dirname(__DIR__) . '/init.php');
require(dirname(__FILE__) . '/Data.php');
$config = require(dirname(__FILE__) . '/config.php');

// Set configuration data for example
\BoltPay\Bolt::$apiKey = @$config['API_KEY'];
\BoltPay\Bolt::$apiPublishableKey = @$config['PUBLISHABLE_KEY'];
\BoltPay\Bolt::$apiPublishablePaymentOnlyKey = @$config['PUBLISHABLE_KEY_PAYMENT_ONLY'];
\BoltPay\Bolt::$signingSecret = @$config['SIGNING_SECRET'];
\BoltPay\Bolt::$isSandboxMode = @$config['IS_SANDBOX'];
\BoltPay\Bolt::$authCapture = @$config['AUTH_CAPTURE'];
\BoltPay\Bolt::$connectSandboxBase = !@$config['CONNECT_SANDBOX_BASE'] ?: $config['CONNECT_SANDBOX_BASE'];
\BoltPay\Bolt::$connectProductionBase = !@$config['CONNECT_PRODUCTION_BASE'] ?: $config['CONNECT_PRODUCTION_BASE'];
\BoltPay\Bolt::$apiSandboxUrl = !@$config['API_SANDBOX_URL'] ?: $config['API_SANDBOX_URL'];
\BoltPay\Bolt::$apiProductionUrl = @$config['API_PRODUCTION_URL'] ?: $config['API_PRODUCTION_URL'];

How to Integrate with Bolt Checkout

  1. Generate an order token by sending a POST request to /v1/merchant/orders.
  2. Install the Checkout Button on your storefront using /v1/checkout_button.
  3. Build out your Merchant API to interact with the Bolt API and handle various operations for the order, such as:
  4. Listen for webhook events related to the order’s changing transaction status.

Sections in This Guide

How to Create a Bolt Order Token
Learn how to build a request that initiates checkout using a token.
How to Install the Checkout Button
Learn how to add scripts to your storefront and call Bolt Checkout.
1 article
How to Set Up Pre-Authorization
Learn how to create and test pre-authorization order flows.
About the Merchant API
Learn how to connect and communicate with your Merchant API.
How to Set Up Hook URLs
Learn how to configure Hook URLs in the Bolt Merchant Dashboard.
How to Set Up Shipping & Tax Endpoints
Learn how to build and send shipping and tax payloads to Bolt Checkout.
How to Apply Discounts
How to call the Merchant API and verify discount codes submitted by a shopper.