Skip to content

Onboarding ​

Before you can call the Bahn REST API or embed the Web SDK, you complete a one-time onboarding with the Bahn team. Onboarding produces the credentials every later step depends on: your merchant account, an exchanged set of public keys, a server-side API key, and a client-side publishable key.

Some steps are handled manually by the Bahn team — creating your merchant account is not self-service.

Overview ​

sequenceDiagram
    autonumber
    participant You as You (Merchant)
    participant Bahn as Bahn Team
    participant API as Bahn API

    Note over You, Bahn: Step 1 — Create merchant account (manual)
    You ->> Bahn: Request onboarding (business details)
    Bahn -->> You: Merchant account created

    Note over You, API: Step 2 — Exchange public keys
    You ->> You: Generate P-256 key pairs (sig + enc)
    You ->> Bahn: Submit your public keys (JWK)
    You ->> API: GET /api/public-keys
    API -->> You: Bahn's public keys (JWK)

    Note over You, Bahn: Step 3 — Receive API key
    Bahn -->> You: Bn-Api-Key (secret, server-side)

    Note over You, Bahn: Step 4 — Receive publishable key
    Bahn -->> You: Publishable key (pk_..., client-side)

Step 1 — Create your merchant account ​

Creating a merchant account is a manual step. Contact Bahn (your account manager) to get onboarded. The Bahn team provisions your merchant account so the credentials in the following steps can be issued.

Provide the following information so Bahn can set up your account:

Account details

FieldDescription
nameYour merchant / business name.
mccMerchant Category Code (ISO 18245) describing your line of business.
city_codeCity code of your business location.
country_codeCountry code of your business location.
settlement_currencyCurrency in which Bahn settles funds to you.
payment_currencyCurrency your buyers are charged in.

Business details

FieldDescription
website_urlYour business website.
contact_personPrimary contact name.
contact_phoneContact phone number.
contact_emailContact email address.
descriptionShort description of your business.
cityCity.
countryCountry.
address_line1Street address, line 1.
address_line2Street address, line 2 (optional).

Webhook configuration

FieldDescription
webhook_urlHTTPS endpoint where Bahn delivers webhook events.
webhook_enabled_eventsThe event types you want delivered to your webhook.

INFO

There is no self-service API to create a merchant — this step is completed by the Bahn team during onboarding.

Step 2 — Exchange public keys ​

Bahn secures request and response payloads with the JOSE framework, so you and Bahn exchange public keys once.

  1. Generate two P-256 key pairs — one for signing requests (JWS), one for decrypting responses (JWE). See Generate Key Pairs. Your private keys never leave your systems.
  2. Submit your public keys to Bahn — send both public keys in JWK format. Each key must include a kid and a use (sig or enc). See Public Key Requirements.
  3. Fetch Bahn's public keys — retrieve the JWK keys Bahn uses so you can encrypt sensitive card data client-side and verify signed responses:
http
GET /api/public-keys

Step 3 — Receive your API key ​

Once your merchant account is created, Bahn issues your API key. Send it on every REST request using the Bn-Api-Key header — see API Key.

WARNING

The API key is a server-side secret. Never expose it in a browser, mobile app, or public repository. If it is compromised, contact Bahn support to have it rotated.

Step 4 — Receive your publishable key ​

For client-side card collection with the Web SDK, Bahn issues a publishable key (pk_...). Unlike the API key, the publishable key is safe to embed in your frontend. Use it to initialize the SDK — see Web SDK · Getting Started.

Credentials summary ​

CredentialTypeUsed forProvided by
Signing & encryption key pairsYour keys (private stays with you)JWS signing / JWE decryptionYou — Step 2
Bahn public keysPublic (JWK)Encrypting card data, verifying responsesBahn — GET /api/public-keys
API key (Bn-Api-Key)SecretServer-side REST callsBahn — Step 3
Publishable key (pk_...)PublicWeb SDK (client-side)Bahn — Step 4

Next Steps ​

Developers