For POS apps · Docs
Tap to pay on any Android POS.
Your terminal turns into an NFC tag for the length of a sale. The customer taps their phone, the payment opens in their browser, and they finish the transfer in their own bank app. No app for the customer to install, no card scheme.
The flow
How it works
- 01
Ring up the sale
Your POS app creates a payment on the Flashpay API for the amount and this device.
- 02
Arm the tap
The Flashpay HCE SDK makes the terminal serve the payment's checkout link over NFC.
- 03
Customer taps
Their phone reads the link and opens the checkout in the browser. Nothing to install.
- 04
Customer picks their bank
Their banking app opens with the payment filled in, and they authorise it there.
- 05
You get the result
Your app checks the payment's status and prints the receipt.
- 06
Disarm
Stop serving the link once the sale is done.
Before you start
Sandbox and production
Use the same secret API key as an online integration (see Authentication), in the environment you're calling. Sandbox and production don't share keys, stores or devices.
| Sandbox | Production | |
|---|---|---|
| API | https://api.sandbox.flashpayweb.com | https://api.flashpayweb.com |
| Checkout | https://pay.sandbox.flashpayweb.com | https://pay.flashpayweb.com |
Once per terminal
Register the device
Each terminal is a device in the merchant portal. Open Devices, add one, and give it:
| Field | Notes |
|---|---|
| Device ID | Your own ID for the terminal, e.g. its serial number. Your POS app sends it with every payment. |
| Type | nfc for a tap terminal or sticker, qr for a printed code |
| Settlement account | Bank, account number and account name the money goes to |
| Store | The location the device belongs to |
| Label | A name you'll recognise, e.g. "Till 2" |
Install the SDK
The Flashpay HCE SDK is on Maven Central as com.flashpayweb:hce-android. It registers its own NFC service, so you don't touch the manifest.
- Android 5.0 (API 21) or later, on a terminal with NFC card emulation (HCE).
- Kotlin 1.8+ and JDK 17 to build.
- HCE doesn't work in the Android emulator: test on the real terminal.
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}Create a payment
When the cashier rings up a sale, create the payment the same way as online, plus the terminal's deviceId. The response's id is the payment you'll serve on tap.
Call the API from your back office, not from the terminal, so the secret key never sits on a device in the shop. amount is in kobo: NGN 5,000 is 500000. The other fields work as in Create a payment.
curl -X POST https://api.flashpayweb.com/api/v1/payment \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"storeId": "loc_YOUR_STORE_ID",
"deviceId": "TILL-2",
"amount": 500000,
"currency": "NGN",
"reference": "sale-1042",
"idempotencyKey": "sale-1042",
"destinationBankId": "YOUR_BANK_CODE",
"destinationAccount": "YOUR_ACCOUNT_NUMBER",
"destinationAccountName": "Your Business Ltd"
}'Serve it on tap
Call init once, then activate with the payment's checkout link. From then on, any phone held to the terminal opens that link.
| Call | What it does |
|---|---|
| init(context, callback) | Set up the SDK and your callback. Call before activate. |
| activate(url) | Start serving url, the link to serve (not blank). |
| deactivate() | Stop serving it. |
| isActive() | Whether a link is being served. |
Use the payment's own link, https://pay.flashpayweb.com/pay/<payment id> (sandbox: pay.sandbox.flashpayweb.com), so each tap opens exactly the sale on screen.
The terminal acts as a standard NFC Forum Type 4 tag (NDEF application D2760000850101), so phones open the link natively, and it doesn't clash with card payment applications on the same terminal.
class CheckoutActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
FlashpayHce.init(this, object : HceCallback {
override fun onTagRead(url: String) {
// A phone read the link.
}
override fun onDeactivated(reason: DeactivationReason) {
// LINK_LOSS after every tap is normal: the phone moved away.
}
override fun onError(error: HceError) {
// NfcNotAvailable, NfcDisabled or InvalidUrl
}
})
}
fun armTap(paymentId: String) {
// Replaces whatever link was served before
FlashpayHce.activate("https://pay.flashpayweb.com/pay/$paymentId")
}
fun disarm() = FlashpayHce.deactivate()
}Get the result
The customer finishes in their bank app, so the terminal learns the outcome from Flashpay. Check the payment from your back office (every 2 seconds is fine) until it reaches a final status, then print the receipt and call deactivate().
| Status | Meaning |
|---|---|
| OPEN | Waiting for the customer to tap and pick a bank |
| IN_PROGRESS, PENDING | The customer's bank has it |
| SUCCESSFUL, COMPLETED | Paid: print the receipt |
| REVERSED | The bank reversed a paid sale |
| FAILED, CANCELLED, EXPIRED | Not paid: offer to try again |
If the customer gives up before picking a bank, cancel the sale from your back office so the link stops working, then call deactivate(). See Cancel a payment: it only works while the payment is still OPEN.
curl https://api.flashpayweb.com/api/v1/payment/PAYMENT_ID \
-H "Authorization: Bearer YOUR_SECRET_KEY"No terminal needed
QR and NFC stickers
A printed QR code or an NFC sticker carries a fixed link for one device instead of one payment. It opens a page with the device's settlement account and a bank picker, and the customer enters the amount in their bank app. Good for counters and market stalls without a terminal.
| Sticker | Link | Opens |
|---|---|---|
| QR code | https://pay.flashpayweb.com/qr/<device id> | Account details and bank picker |
| NFC sticker | https://pay.flashpayweb.com/nfc/<device id> | Account details and bank picker |
Troubleshooting
| Problem | Fix |
|---|---|
| onError: NfcNotAvailable | The terminal doesn't expose Android card emulation. Use a QR code instead. |
| onError: NfcDisabled | Ask the cashier to turn NFC on in Settings. |
| onError: InvalidUrl | The URL passed to activate() was blank. |
| The phone does nothing on tap | Check NFC is on in the customer's phone and hold it still on the terminal's NFC area for a second. |
| The checkout says the payment wasn't found | The link and the API key are from different environments. |