Introduction

Accept in-person card payments with Tap to Pay on iPhone and Android.

The Terminal SDK (@lemonway/terminal) is a React Native library that turns the merchant's phone into a card terminal with Tap to Pay on iPhone and Android. The customer taps their card or wallet on the phone, and the payment goes through a PayGreen Payment Order.

Your app never handles card data and never holds a secret key.

🚧

Beta

The SDK is in beta (0.1.0-beta.x). Its API can still change between beta versions.


Core concepts

ConceptWhat it is
💳 Payment OrderCreated with source: tap_to_pay by your backend or an authenticated merchant app. It sets the amount.
🔑 Object SecretReturned once when the Payment Order is created. Lets the app authorize that Payment Order only, with your public key.
🟢 Public KeyIdentifies your shop in the app (pk_…). Safe to ship in the app.
🔒 Secret KeyUsed by your backend to get a JWT. Never ship it in the app.
📡 Connection tokenShort-lived token that opens a Tap to Pay session. Your app provides it to the SDK through tokenProvider.
📍 LocationThe shop's Tap to Pay location (tml_…). Returned with the connection token.

Payment flow at a glance

sequenceDiagram
    participant B as Your backend
    participant A as Your app + SDK
    participant P as PayGreen API
    B->>P: Create Payment Order (JWT, source tap_to_pay)
    P-->>B: id + object_secret
    B-->>A: id + object_secret
    A->>P: authorizePaymentOrder() (public key + object_secret)
    P-->>A: authorized payment
    A->>A: collectPayment(): the customer taps
    P-->>B: Webhook payment_order.tap_to_pay.*
  1. Create the Payment Order on your backend or from an authenticated merchant app. The sequence above shows the backend integration.
  2. The app authorizes it with authorizePaymentOrder(), then collects the card with collectPayment().
  3. Use SDK events to update the UI and confirm the captured order before completing the sale.

Before you start

Use a validated merchant account with the bank card (SVAD) payment method enabled. Contact Lemonway customer support to request Tap to Pay access for your account. Wait for approval before starting the integration.

  • Get your shop’s public key. For a backend integration, keep the shop’s secret key on the server. Manage your keys in your account.
  • Use a React Native app with an Expo development build or React Native CLI.
  • Check supported phones.

Integration steps

  1. Getting Started: install the SDK and set up the native project.
  2. Backend integration: create Payment Orders and serve connection tokens.
  3. Init and connect: initialize the SDK and connect the phone.
  4. Payment Flow: take payments.
  5. Confirm payments: listen to webhooks on your backend.
  6. Error handling and Events: build the UI around them.

Did this page help you?