> ## Documentation Index
> Fetch the complete documentation index at: https://docs.straddle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bridge API overview

> Use the Straddle Bridge open-banking platform to securely connect customer identities to bank accounts and generate paykeys for initiating ACH payments.

Learn how **Bridge** and **paykeys** work together in Straddle's **Pay by Bank** solution. Together, they enable secure account-to-account (A2A) payments.

By integrating Bridge into your application, you can:

* **Enable open banking connections**: Allow customers to connect their bank accounts securely using Bridge.
* **Identity-to-account**: Generate paykeys to match customer identities with bank account ownership details.
* **Initiate secure payments**: Use paykeys as secure tokens to initiate payments without exposing sensitive information.

This guide walks you through the concepts, processes, and best practices for integrating Bridge and paykeys.

## What is Bridge?

**Bridge** is Straddle's universal open banking solution that enables customers to connect their bank accounts seamlessly within your application. It serves as the gateway for establishing a secure link between the customer's verified identity and their bank account.

> [card] Easy open banking
>
> Drop-in widget with connections to over 90% of U.S. banks via open banking, plus support for manual bank account entry

> [card] Bring your own token
>
> Accept existing tokens from other open banking providers like Plaid, MX, and Finicity

> [card] Generate paykeys
>
> Create secure payment tokens linking verified identities to bank accounts

> [card] Increase conversion
>
> Provide a seamless way for customers to connect their bank accounts

> [card] Stay compliant
>
> Your application never touches sensitive account data, simplifying compliance with data protection regulations

> [card] Reduce fraud
>
> Dramatically reduce fraud risk by ensuring the person initiating a payment is the verified owner of the linked bank account

Unlike other open-banking solutions, Bridge provides multiple ways to connect your application to bank accounts:

> [accordion] Bridge Widget
>
> An embeddable interface that allows customers to connect their bank accounts directly within your application.

> [accordion] Third-party token support
>
> Use existing tokens from your existing open banking provider with support for "processor tokens" from Plaid, MX, and Finicity.

> [accordion] Manual bank account entry
>
> Allow customers to manually enter their bank account details when open banking isn't an option.

## What are paykeys?

A **paykey** is a payment token that Straddle generates after a successful **Bridge** connection. It represents the verified linkage between the customer's identity and their bank account, enabling you to initiate payments securely without exposing sensitive financial information.

> [!NOTE]
>
> The key innovation of paykeys is that they cryptographically link a verified identity to confirmed bank account ownership. This linkage dramatically reduces fraud risk compared to traditional ACH payments.

> [card] Fraud reduction
>
> By ensuring the person initiating a payment is the owner of the bank account, paykeys significantly reduce the risk of unauthorized transactions.

> [card] Simplified compliance
>
> Paykeys help meet KYC and AML requirements by tying verified identities to bank accounts, simplifying regulatory compliance.

> [card] Enhanced security
>
> Sensitive bank details are never exposed, reducing the risk of data breaches and simplifying PCI DSS compliance.

> [card] Improved UX
>
> You can reuse paykeys for multiple transactions, streamlining the payment process for returning customers.

> [!TIP]
>
> For a deep dive into how paykeys work, see [Paykeys](https://docs.straddle.com/guides/bridge/paykeys.md).

## How Bridge creates paykeys

Straddle handles most of the paykey generation process internally. The process follows these steps:

**1. Verify the customer's identity**

Create a customer using Straddle's Customers API.

* You collect and submit basic customer information (name, email, phone, address)
* Straddle performs robust identity verification and KYC/AML checks internally
* You receive a `customer_id` for the verified customer

**2. Connect the bank account**

Use Bridge to connect the customer's bank account.

* Initiate the Bridge flow (widget, API, or manual entry)
* Customer provides their bank account information through the chosen method
* Bridge securely handles the bank account connection, extracting bank account numbers and ownership details

**3. Match identity to account ownership**

Straddle performs crucial matching to link identity and account ownership.

* Straddle compares the verified identity information with the bank account ownership details
* Straddle uses the WALDO algorithm to check for name matches, address correlation, and other identifying factors
* This step ensures that the person whose identity was verified is indeed the owner of the connected bank account

**4. Generate the paykey**

After a successful match, Straddle generates the paykey.

* Straddle creates a secure, cryptographic token (the paykey) that represents the verified identity-account linkage
* Straddle returns the paykey in the Bridge API response

**5. Store and use the paykey**

Securely store and use the paykey for payments.

* Store the paykey securely in your system
* Use the paykey to initiate payments via Straddle's Payments API

> [!NOTE]
>
> Straddle handles the complex parts of this process internally, including identity verification, bank account validation, and identity-to-account ownership matching. This simplifies your integration and provides a strong foundation for secure, low-fraud payments.

## Integrate Bridge into your application

### Step-by-step integration

> [!WARNING]
>
> You must create a `customer` before you can connect with Bridge. View the [Customers API](https://docs.straddle.com/api-reference/customers/create.md) for more information.

**1. Choose your connectivity method**

Decide how you want customers to connect their bank accounts:

> [card] Bridge Widget
>
> Use the embeddable widget for a seamless experience

> [card] Third-party tokens
>
> Use Bridge with tokens from providers like Plaid

> [card] Manual entry
>
> Allow manual input of bank details

**2. Use Bridge to generate a paykey**

Follow the implementation guide for your chosen method:

> [accordion] Bridge widget implementation
>
> Create a Bridge token on your server with `POST /v1/bridge/sessions`, then add the `<straddle-bridge>` element to your page with that token. When the customer finishes, the widget fires `straddlecomplete` with the new paykey. Check its `status` before you continue: an `active` paykey is ready for payments, and a paykey in `review` needs your approval first.
>
> For the snippet, the token request, and every widget event, see the [Bridge widget guide](https://docs.straddle.com/guides/bridge/widget.md#quickstart).

> [accordion] Third-party token implementation
>
> **1. Obtain a third-party token**
>
> Use your existing integration with Plaid, MX, or Finicity to obtain a processor token for the customer's previously connected bank account.
>
> **2. Create a paykey using the token**
>
> Make a server-side POST request to the Bridge API to create a paykey using the third-party token:
>
> ```bash Create paykey from Plaid token theme={null}
> curl -X POST https://api.straddle.com/v1/bridge/plaid \
>   -H "Authorization: Bearer YOUR_SECRET_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "customer_id": "0191ef41-8de5-716c-bfa4-41cd79e85705",
>     "plaid_token": "plaid_processor_token"
>   }'
> ```

> [accordion] Manual bank accounts
>
> Use the Bridge API to create a paykey from existing bank account details:
>
> ```bash Create paykey from bank account theme={null}
> curl -X POST https://api.straddle.com/v1/bridge/bank_account \
>   -H "Authorization: Bearer YOUR_SECRET_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "customer_id": "cus_123456789",
>     "account_holder": "John Doe",
>     "routing_number": "110000000",
>     "account_number": "000123456789",
>     "account_type": "checking"
>   }'
> ```

**3. Handle the generated paykey**

Store the paykey securely and use it for future payment initiation.

```json Paykey response example theme={null}
{
  "data": {
    "paykey": "05f5d55cb14f7e8a0ec2e5689376e3b4665efc34834d30995babbd5010b39913",
    "bank_data": {
      "routing_number": "011000138",
      "account_number": "******7890",
      "account_type": "checking"
    },
    "id": "0191ef49-892c-7460-99d1-f5589d7d9989",
    "customer_id": "0191ef41-8de5-716c-bfa4-41cd79e85705",
    "label": "BANK OF AMERICA, N.A. - *7890",
    "source": "straddle",
    "institution_name": "BANK OF AMERICA, N.A.",
    "status": "active",
    "created_at": "2024-09-14T06:47:39.5648743Z",
    "updated_at": "2024-09-14T06:47:39.5648746Z"
  },
  "meta": {
    "api_request_id": "243431dd-7deb-4445-820d-55a942ace70f"
  },
  "response_type": "object"
}
```

## Best practices

* Always use HTTPS for all API calls and data transmissions.
* Implement proper error handling to manage failed paykey generations or bank connections.
* Regularly rotate your API keys and use environment-specific keys (test/live).
* Implement webhook handlers to receive real-time updates on paykey and payment statuses.
* Provide clear instructions and support for customers during the bank connection process.

## Frequently asked questions

> [accordion] How secure is the paykey generation process?
>
> Straddle secures paykey generation with BLAKE3 hashing, encryption, and strict access controls. Straddle never exposes or stores sensitive data in plain text.

> [accordion] Can you reuse paykeys for multiple payments?
>
> Yes. Paykeys are reusable for multiple payments, including one-time, recurring, and subscription payments. Ensure secure management and compliance with tokenization standards.

> [accordion] How does Bridge handle third-party tokens?
>
> Bridge accepts tokens from providers like Plaid, MX, and Finicity. When you provide the token, Bridge retrieves bank account details and generates a paykey without requiring the customer to reconnect their bank account.

> [accordion] What happens if there's a mismatch during data verification?
>
> If Straddle detects a mismatch between the customer's verified identity and bank account ownership details, paykey generation fails. Handle this gracefully by informing the customer and providing options to rectify the issue.

## Additional resources


## Related topics

- [Platform API interactions](https://docs.straddle.com/guides/embed/api-headers.md)
- [Create paykeys from raw bank account details](https://docs.straddle.com/guides/bridge/bank-account.md)
- [Create paykeys from Plaid processor tokens](https://docs.straddle.com/guides/bridge/plaid-token.md)
- [Quiltt integration for ACH payments](https://docs.straddle.com/integrations/open-banking/quiltt.md)
- [Plaid integration for ACH payments](https://docs.straddle.com/integrations/open-banking/plaid.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.