# API Reference

> Complete API reference for the Bolt iOS SDK: delegates, result types, callbacks, and data models.

Source: https://help.boltapp.com/developers/sdks/ios-swift/api-reference

This page provides the complete reference for all delegate protocols, result types, and data models in the Bolt iOS SDK (`BoltCheckoutSDK`).

## BoltSimpleCheckoutDelegate [#boltsimplecheckoutdelegate]

Implement this delegate when using `startCheckout(config:delegate:)` or `BoltCheckoutViewController(config:delegate:)`.

| Callback                        | Parameters                   | Description                                                                                                                                                                                |
| ------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `onCheckoutSuccess(result:)`    | `result: BoltCheckoutResult` | Called when the user completes checkout and payment is authorized. Use `result.cart?.orderReference`, `result.reference`, and `result.merchantOrderNumber` to reconcile with your backend. |
| `onCheckoutError(errorReason:)` | `errorReason: String`        | Called when checkout fails due to a network error, payment decline, validation failure, or other unexpected issue.                                                                         |
| `onCheckoutCancel()`            | *(none)*                     | Called when the user dismisses the checkout UI. The order token remains valid for a subsequent attempt.                                                                                    |

***

## BoltCheckoutResult [#boltcheckoutresult]

`onCheckoutSuccess` receives a `BoltCheckoutResult` that mirrors Bolt's **ClientTransactionView**. All fields are optional where the type allows `nil`.

### Reconciliation Fields [#reconciliation-fields]

| Field                  | Role                                                     |
| ---------------------- | -------------------------------------------------------- |
| `cart?.orderReference` | Bolt order reference string.                             |
| `reference`            | Transaction reference from the payment processor.        |
| `merchantOrderNumber`  | Your merchant-facing order number when Bolt provides it. |
| `amount`               | Charged totals: see `BoltAmountView` below.              |

### Transaction Core [#transaction-core]

| Field       | Type             | Description                                         |
| ----------- | ---------------- | --------------------------------------------------- |
| `id`        | `String`         | Transaction ID.                                     |
| `type`      | `String`         | Transaction type.                                   |
| `processor` | `String`         | Payment processor identifier.                       |
| `date`      | `Int`            | Transaction timestamp (Unix epoch milliseconds).    |
| `reference` | `String`         | Transaction reference.                              |
| `status`    | `String`         | Overall transaction status.                         |
| `amount`    | `BoltAmountView` | Primary amount: use for display and reconciliation. |

### BoltAmountView [#boltamountview]

| Field            | Type     | Description                                      |
| ---------------- | -------- | ------------------------------------------------ |
| `amount`         | `Int`    | Amount in **minor currency units** (e.g. cents). |
| `currency`       | `String` | ISO 4217 code (e.g. `"USD"`).                    |
| `currencySymbol` | `String` | Display symbol (e.g. `"$"`).                     |

### Parties and Payment Instruments [#parties-and-payment-instruments]

| Field            | Type                  | Description                                                       |
| ---------------- | --------------------- | ----------------------------------------------------------------- |
| `fromConsumer`   | `BoltConsumerView?`   | Payer (id, email, firstName, lastName, phone).                    |
| `toConsumer`     | `BoltConsumerView?`   | Payee when applicable.                                            |
| `fromCreditCard` | `BoltCreditCardView?` | Card used (id, last4, bin, expiration, network, billing address). |
| `toCreditCard`   | `BoltCreditCardView?` | Destination card when applicable.                                 |
| `last4`          | `String?`             | Last four digits of the card at the transaction level.            |

### Authorization, Capture, and Risk [#authorization-capture-and-risk]

| Field                     | Type                          | Description                                               |
| ------------------------- | ----------------------------- | --------------------------------------------------------- |
| `authorization`           | `BoltAuthorizationView?`      | `status` and `reason` for the auth decision.              |
| `captures`                | `[BoltCaptureView]?`          | Capture records (`status`, `amount` as `BoltAmountView`). |
| `credit`                  | `BoltCreditView?`             | Credit leg status when present.                           |
| `transactionProperties`   | `BoltTransactionProperties?`  | `avsResult`, `cvvResult` from the processor.              |
| `orderDecision`           | `BoltOrderDecisionView?`      | Fraud/order decision (`score`, `decisionFactors`).        |
| `riskScore`               | `Double?`                     | Risk score when provided.                                 |
| `customerListStatus`      | `BoltCustomerListStatus?`     | `autoApproved`, `blockListed`.                            |
| `indemnificationDecision` | `String?`                     | Indemnification decision when applicable.                 |
| `indemnificationReason`   | `String?`                     | Indemnification reason when applicable.                   |
| `splits`                  | `[BoltTransactionSplitView]?` | Split payouts (`amount`, `type`).                         |
| `lastViewedUtc`           | `Int?`                        | Last viewed time (epoch ms).                              |
| `viewStatus`              | `String?`                     | View/status string.                                       |
| `hasRefunds`              | `Bool?`                       | Whether refunds exist on the transaction.                 |

### Addresses and Shipping [#addresses-and-shipping]

| Field             | Type                  | Description                                                                                                                      |
| ----------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `shippingAddress` | `BoltAddressInput?`   | Shipping address (names, street, locality, region, postal code, country, phone, email).                                          |
| `billingAddress`  | `BoltAddressInput?`   | Billing address when distinct from shipping.                                                                                     |
| `shippingOption`  | `BoltShippingOption?` | Selected shipping option. When valid, `value` includes `service`, `cost`, `reference`, carrier, ETA, tax, and signature details. |

### Cart, Integrations, and Notes [#cart-integrations-and-notes]

| Field                  | Type                         | Description                                                                           |
| ---------------------- | ---------------------------- | ------------------------------------------------------------------------------------- |
| `cart`                 | `BoltTransactionCart?`       | `orderReference`, `discounts` (`BoltCartDiscountView`), `items` (`BoltCartItemView`). |
| `shopify`              | `BoltShopifyResponse?`       | Shopify-hosted payment fields when applicable.                                        |
| `sfcc`                 | `BoltSfccOrderResponse?`     | SFCC integration: `sfccOrderToken` when present.                                      |
| `customFieldResponses` | `[BoltCustomFieldResponse]?` | Custom fields: `publicId`, `response`.                                                |
| `userNote`             | `String?`                    | User-supplied order note when captured.                                               |

***

## BoltLoginDelegate [#boltlogindelegate]

Implement this delegate when using `startLogin(delegate:)` or `BoltLoginViewController(delegate:)`.

| Callback                                       | Parameters                                                  | Description                                                                                                                                      |
| ---------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `onLoginSuccess(authCode:codeVerifier:state:)` | `authCode: String`, `codeVerifier: String`, `state: String` | User authenticated successfully. Send `authCode` and `state` to your backend for token exchange. When PKCE is enabled, also send `codeVerifier`. |
| `onLoginError(errorReason:)`                   | `errorReason: String`                                       | Login failed (network error, invalid session, or user denied permissions).                                                                       |
| `onLoginCancel()`                              | *(none)*                                                    | User dismissed the login screen. No partial session is created.                                                                                  |

***

## BoltPaymentFlowDelegate [#boltpaymentflowdelegate]

Implement this delegate when using `startPaymentFlow(delegate:)` or `BoltPaymentFlowViewController(delegate:)`. The payment flow is a standalone UI for collecting and tokenizing a payment method without running the full checkout.

| Callback                                          | Parameters                                                        | Description                                                                                            |
| ------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `onPaymentFlowSuccess(paymentMethod:creditCard:)` | `paymentMethod: BoltPaymentMethod`, `creditCard: BoltCreditCard?` | Card successfully tokenized. `creditCard` contains token, last4, network, expiration, and postal code. |
| `onPaymentFlowError(errorReason:)`                | `errorReason: String`                                             | Tokenization or network failure.                                                                       |
| `onPaymentFlowCancel()`                           | *(none)*                                                          | User dismissed the payment collection screen.                                                          |

***

## BoltPaymentAuthorizationDelegate [#boltpaymentauthorizationdelegate]

Implement this delegate when calling `authorizePayment()`. Used in custom checkout flows where you collected a card via the payment flow.

| Callback                                         | Parameters                         | Description                                                                                  |
| ------------------------------------------------ | ---------------------------------- | -------------------------------------------------------------------------------------------- |
| `onPaymentAuthorizationSuccess(orderReference:)` | `orderReference: String`           | Payment authorized. Use the reference to confirm the order with your backend.                |
| `onPaymentAuthorizationFail(status:reason:)`     | `status: String`, `reason: String` | Authorization declined by the processor (e.g. insufficient funds, suspected fraud).          |
| `onPaymentAuthorizationError(errorReason:)`      | `errorReason: String`              | Request failed before reaching the processor (e.g. network timeout, missing tokenized card). |
