---
title: Install Bolt payment provider
slug: commerce-connect-15/docs/install-bolt-payment-provider
docTags: 
createdAt: 2026-07-30T20:34:41.000Z
---

Set the configuration options that your Bolt merchant account provides. The values are in the **Developers** section of the Bolt site.

![Screenshot of the Bolt Developers page that shows the API key, publishable key, and signing secret values](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8OgXGfAGKbzHNP50oNfkJ-20260723-164626.png)

Set the values in `appsettings.json` or in the startup file.

```json
{
  "EpiServer" : {
    "Commerce" : {
      "Bolt" : {
        "PublishableKey" : "key",
        "ApiKey" : "Api Key",
        "DivisionPublicId" : "Public Id",
        "SigningSecret" : "Signing Secret",
        "AutoCapture" : true,
        "EnvironmentType" : "Sandbox"
      }
    }
  }  
}
```

```csharp
services.Configure<BoltOptions>(x =>
{
    x.EnvironmentType = EnvironmentType.Sandbox;
    x.PublishableKey = "Key";
    x.ApiKey = "Api Key";
    x.DivisionPublicId = "Public Id";
    x.SigningSecret = "signing secret";
    x.AutoCapture = true;
});
```

## Configure Bolt payment provider

1. Go to **Commerce** > **Administration** > **Payments**.
2. Click **Create**.
3. Enter the payment provider details. Set **System Keyword** to `Bolt`, **Class Name** to `BoltGateway`, and **Payment Class** to `BoltPayment`.
4. Click **Save**.

Create a Bolt payment provider for each language you plan to support.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/SS1Gyrg6MS98LkPIS8Tmp_b7e75ed-image.png)

## Implement Bolt payment provider

:::hint{type="info"}
**Note**
The Bolt payments API requires two-digit country codes, but a default Commerce installation provides three-digit country codes. Update the `Country` table for the countries you plan to support — there is no way to update the table through the user interface. If you do not use `CountryManager` on the front end for your addresses, skip this step.
:::

For instructions on implementing Bolt checkout, see the [Bolt documentation](https://help.bolt.com/products/accounts/). An example is also available in Foundation.

When creating a Bolt payment, set the following properties so the Bolt gateway can process the transaction:

```csharp
var total = cart.GetTotal(_orderGroupCalculator);
var payment = viewModel.Payment.CreatePayment(total.Amount, cart);

if (payment is BoltPayment boltPayment) {
  // The token comes from the Bolt JavaScript tokenize function. Required only for new card payments.
  boltPayment.Token = "token";

  // The CreateAccount value comes from the Bolt createAccount widget flag in the Bolt JavaScript API.
  boltPayment.CreateAccount = true;

  // Set CardId only for saved cards. For non-saved cards, the gateway sets this field automatically on Auth or Capture.
  boltPayment.CardId = "cardId";

  // The API service is in the EPiServer.Commerce.Bolt namespace. The code and scope come from the response of the authorization component in the Bolt JavaScript SDK.
  var token = await _apiService.GetTokenAsync(code, scope);

  // This field is not persisted to the database, but is required to make a request on behalf of the user.
  boltPayment.AccessToken = token.AccessToken;
}

cart.AddPayment(payment, _orderGroupFactory);
payment.BillingAddress = _addressBookService.ConvertToAddress(viewModel.BillingAddress, cart);
```

To retrieve a list of saved Bolt cards:

```csharp
[HttpGet]
public async Task<IActionResult> GetBoltCards([FromQuery] string code, [FromQuery] string scope) {
  var token = await _apiService.GetTokenAsync(code, scope);
  if (token == null) {
    return new JsonResult(null);
  }

  var account = await _apiService.GetAccountAsync(token.AccessToken);
  if (account == null) {
    return new JsonResult(null);
  }

  account.Token = token.AccessToken;
  return new JsonResult(account);
}
```
