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.
BetaThe SDK is in beta (
0.1.0-beta.x). Its API can still change between beta versions.
Core concepts
| Concept | What it is |
|---|---|
| 💳 Payment Order | Created with source: tap_to_pay by your backend or an authenticated merchant app. It sets the amount. |
| 🔑 Object Secret | Returned once when the Payment Order is created. Lets the app authorize that Payment Order only, with your public key. |
| 🟢 Public Key | Identifies your shop in the app (pk_…). Safe to ship in the app. |
| 🔒 Secret Key | Used by your backend to get a JWT. Never ship it in the app. |
| 📡 Connection token | Short-lived token that opens a Tap to Pay session. Your app provides it to the SDK through tokenProvider. |
| 📍 Location | The 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.*
- Create the Payment Order on your backend or from an authenticated merchant app. The sequence above shows the backend integration.
- The app authorizes it with
authorizePaymentOrder(), then collects the card withcollectPayment(). - 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
- Getting Started: install the SDK and set up the native project.
- Backend integration: create Payment Orders and serve connection tokens.
- Init and connect: initialize the SDK and connect the phone.
- Payment Flow: take payments.
- Confirm payments: listen to webhooks on your backend.
- Error handling and Events: build the UI around them.
Updated 8 days ago
Did this page help you?