---
title: "Create Payment Session"
method: POST
path: "/v1/payment-sessions/"
tags: ["Payments"]
---

# Create Payment Session

`POST /v1/payment-sessions/`

Create a payment session (merchant-facing). Called by plugins (WooCommerce, Medusa, etc.) to start a BKey-approved payment flow. The merchant authenticates with a mk_live_* / mk_test_* API key. Returns an approvalUrl to redirect the shopper to.

## Request body

- object
  - `merchantDomain` string
  - `externalOrderId` string
  - `amount` integer, required
  - `currency` string
  - `lineItems` object[], required
    - `title` string, required
    - `quantity` integer, required
    - `price` integer, required
  - `returnUrl` string, uri, required
  - `notifyUrl` string, uri
  - `cancelUrl` string, uri
  - `customerEmail` string, email
  - `expiresInSecs` integer

## Response `200`

Default Response

- object
  - `success` boolean, required
  - `paymentSession` object, required
    - `id` string, required
    - `status` string, required — One of: pending, awaiting_approval, approved, completed, rejected, failed, expired, refunded
    - `approvalUrl` string, required — URL the shopper visits to approve payment
    - `amount` integer, required
    - `currency` string, required
    - `merchantName` string
    - `lineItems` object[]
      - `title` string, required
      - `quantity` integer, required
      - `price` integer, required — Price in smallest currency unit (e.g., cents)
    - `expiresAt` string, date-time, required
    - `merchantDomain` string
    - `createdAt` string, date-time
    - `externalOrderId` string, nullable — Merchant's own order ID — echoed back so the merchant plugin can correlate the BKey session with the shop's order.
    - `sptId` string, nullable — Stripe Payment Token ID. Populated after payment succeeds.
    - `paymentIntentId` string, nullable — Stripe PaymentIntent ID. Populated after payment succeeds.
    - `returnUrl` string — Merchant success redirect URL.
    - `cancelUrl` string — Merchant cancel redirect URL.
    - `paymentResult` object — Raw payment processor result (Stripe-shaped). Present on completed / failed sessions.

## Other responses

- `400` — Default Response
- `401` — Missing or invalid merchant API key
- `403` — Default Response

---

[API](https://skmtc.net/bkeyid/apis/bkey-api.md) · [All operations](https://skmtc.net/bkeyid/apis/bkey-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bkeyid/bkey-api/revisions/2c7566abec9e/schema)
