Payment Operations
Process contactless card payments using the EdfaPay Soft POS SDK: Purchase, Authorize, Capture, Refund and Reverse with the full NFC workflow, plus invoice payments (BNPL and Checkout).
Transactions
The EdfaPay Soft POS SDK provides card payment operations for the transaction lifecycle, plus invoice-based payments (BNPL & Checkout) as of v1.0.7. Purchase, refund, reversal and reconciliation are enabled for every terminal by default. Authorize, capture, extension and void are coming soon. EdfaPay or the merchant's partner can turn an operation on or off for a terminal: before an operation starts, the SDK checks the terminal profile, and an operation that is turned off ends in onError with a message that names the feature (for example REFUND).
Payment Transaction Lifecycle
Understanding the logical paths from initialization to settlement.
1. SDK Initialization
Session setup, terminal configuration download, and security attestation.
Option A: Direct Sale
Purchase Operation
Authorization and capture in one atomic step. Recommended for standard retail.
Option B: Deferred Sale
Authorize Operation
Funds held on the card. Requires a separate Capture step to claim. Used for hotels/rentals.
3. Active Management
4. Settlement & Finality
End-of-day reconciliation pushes funds to your merchant account.
Process a standard sale transaction
Refund a previous purchase
Reverse the last purchase within 60 seconds
BNPL (Tamara, Tabby) & Checkout — new in v1.0.7
Coming soon: pre-authorization (hold funds)
Coming soon: capture a pre-authorized amount
Coming soon: cancel an authorization
Coming soon: add to an authorized amount, for example from 200 to 300
TxnParams — Transaction ParametersUpdated v1.0.5
TxnParams holds what you pass to purchase, authorize, capture and refund: amount, an optional orderId and, for capture and refund only, originalTransaction. amount is a decimal string in the terminal currency, for example "150.00", and must be greater than zero; the SDK formats it to the currency's decimal places. orderId is sent with purchase requests; if you leave it out, the SDK uses the transaction id it generates. You do not set the transaction type: each operation sets its own.
Loading...Transaction Types
Each SDK function sets its own transaction type, so TxnParams has no type for you to set. Choose the function for the operation you need:
| Operation | Function | originalTransaction | PIN always requested |
|---|---|---|---|
| Purchase | purchase() | None | No |
| Authorize (hold funds), coming soon | authorize() | None | No |
| Capture, coming soon | capture() | Required: the AUTHORIZE transaction | No |
| Refund | refund() | Required: the PURCHASE transaction | No |
| Reverse | reverseLastTransaction() | Not used: it reverses the last transaction the SDK stored | No |
| Change PIN, coming soon | changePin() (see Card Management) | None | Yes |
| Card activation, coming soon | activateCard() (see Card Management) | None | Yes |
Flow Types
FlowType controls the screens the SDK shows after the card is read, and how often onPaymentProcessComplete is called. The default is DETAIL.
| FlowType | Description | Use Case |
|---|---|---|
| FlowType.IMMEDIATE | The card screen closes when the server responds. onPaymentProcessComplete is called once, with isFlowComplete = true. If the server does not answer in time, the call has status = false; onRequestTimerEnd is not called and the SDK sends no reversal request. | Your app shows its own result screen and handles timeouts itself |
| FlowType.STATUS | Shows the approved or declined status, then closes. onPaymentProcessComplete is called when the server responds (isFlowComplete = false) and when the status screen closes (isFlowComplete = true). If the server does not answer in time, onRequestTimerEnd is called and the SDK sends a reversal request. | Simple feedback |
| FlowType.DETAIL | Shows the status, then the full transaction details and receipt with action buttons. onPaymentProcessComplete is called when the server responds, after the status screen, and when the details screen is closed (isFlowComplete = true). A successful action on the details screen calls it again with isFlowComplete = false. Server timeout: as STATUS. | Default customer-facing experience |
PurchaseUpdated v1.0.5
Process a standard sale. The customer taps a contactless card. Pass all five callbacks: onPaymentProcessComplete (the result, see isFlowComplete below), onCardScanTimerEnd (no card was tapped in time), onRequestTimerEnd (the server did not answer in time), onCancelByUser (the card screen was closed) and onError. Without location permission the payment does not start and onError receives "Location permission required to pay"; ask for location before paying (Utils.requestLocationPermission).
Loading...isFlowComplete
onPaymentProcessComplete(status, code, transaction, isFlowComplete) can be called more than once for one payment: first when the server responds, then at each later screen of the chosen FlowType (see Flow Types). Nothing is called when the card is read. isFlowComplete is true on the call that ends the flow. Act on the result only when isFlowComplete is true, for declines as well as approvals: status = false also arrives on earlier calls. A payment can also end through onCardScanTimerEnd (no card tapped; nothing else is called), onCancelByUser (the card screen was closed), onError, or onRequestTimerEnd (the server did not answer in time).
Common Pitfall
Navigating away or granting goods on an earlier call can double-process orders. Treat the transaction as final only when isFlowComplete is true; status then tells you whether it was approved.
CaptureComing soon
Coming soon. Capture takes an amount held by authorize(), up to the authorized amount (partial capture).
Refund
Refund a previously completed purchase. Supports full or partial refunds up to the original transaction amount. originalTransaction must be the PURCHASE: build it with Transaction.withRRN(rrn, date), where date is a java.util.Date (Flutter: DateTime) for the day of the original purchase; the SDK sends it as yyyy-MM-dd. In Kotlin and Java a String date does not compile, and withRRN without a date throws an EdfaException (Transaction date cannot be null). Refund runs the card flow again: the cardholder taps the card, and the callbacks are the same as for purchase.
Loading...VoidComing soon
Coming soon. Void cancels an authorization, so the held amount is released.
Reverse Last TransactionNew in v1.0.5
Reverses the last card transaction the SDK stored. It can be reversed only if it is a purchase that finished less than 60 seconds ago. Otherwise onError receives an EdfaException with one of these messages: Transaction not exist; Transaction reversal window (60 seconds) has expired.; Transaction already reversed; <TYPE> cannot be reversed; Transaction is not reversible. (See Stacktrace). In Kotlin and Java, activity is optional. onSuccess is called only when the reversal succeeds and receives a TxnResponse; a declined reversal ends in onError.
Loading...Invoice Payment (BNPL & Checkout)New in v1.0.7
Process an invoice-based payment through Buy-Now-Pay-Later providers (Tamara, Tabby) or a Checkout payment link, selected via the PaymentMethod enum. The request carries the order, customer contact, invoice line items, and store information; the response returns the checkout id, deeplink, and transaction ids (Kotlin: checkoutID, checkoutDeeplink, paymentGatewayTransactionID, transactionID). invoicePayment and invoiceRefund need the merchant API key in the credentials before initiate() (Kotlin, Flutter: EdfaPayCredentials setApiKey; Java: the five-argument constructor new EdfaPayCredentials(env, null, null, token, apiKey)); without it onError receives a message asking for it. PaymentMethod.CONTACTLESS is not accepted by invoicePayment(). Unlike card payments, amount is a number, not a decimal string; the SDK sends it unchanged, and the samples use minor units (15000 for 150.00 SAR).
| PaymentMethod | Serialized Value | Flow |
|---|---|---|
| TAMARA | tamara | BNPL via Tamara (pay by instalments) |
| TABBY | tabby | BNPL via Tabby (pay by instalments) |
| CHECKOUT | checkout | Payment-gateway checkout link |
| CONTACTLESS | contactless | Soft POS tap-to-pay; not accepted by invoicePayment() |
Loading...Replaces the BNPL API
invoicePayment() replaces buyNowPayLater() and checkoutLinkApi() (for a checkout link, use PaymentMethod.CHECKOUT). invoiceRefund() refunds an invoice payment. In React Native, buyNowPayLater() and checkoutLinkApi() remain as deprecated names that call invoicePayment().
Invoice Request Fields
The request fields differ by platform. Kotlin uses InvoicePaymentRequest; Flutter uses InvoicePaymentRequest and React Native InvoiceRequest, with the fields in the third column.
| Field | Kotlin | Flutter / React Native | Notes |
|---|---|---|---|
| orderId | String, required | Not a parameter; pass orderNumber | Your order reference |
| orderNumber | Not a parameter (accepted as the key for orderId) | Required | Your order number |
| paymentMethod | PaymentMethod, required | Required | TAMARA, TABBY or CHECKOUT |
| amount | Long, required | Number, required | Sent unchanged; the samples use minor units (15000 for 150.00) |
| currency | String, required | Required | For example SAR |
| phoneNumber | String, required | Required | Customer phone number |
| String, required | Required | Customer email | |
| paymentType | String, required | Optional (default PAY_BY_INSTALMENTS) | The SDK replaces it with the value for paymentMethod |
| additionalData | AdditionalData(storeId), required | AdditionalData(storeId), required | Store id |
| invoice | Invoice, optional | Invoice(total, lineItems), required | Invoice total and line items |
| locale | String, optional (default en_US) | Optional (default en_US) | - |
| customerDetails, address, description | Optional | Not available | - |
| merchantId, orderReferenceId | Not in the Kotlin request | Required | - |
Invoice Refund
Refund an invoice payment by its transaction id. amount is a number that the SDK sends unchanged (Kotlin: Double); the samples use minor units. The merchant API key is required, as for invoicePayment.
Loading...Transaction and TxnResponse
onPaymentProcessComplete passes a Transaction (Flutter and React Native: a map with the keys in the second column). reverseLastTransaction passes a TxnResponse to onSuccess: code (0000 = success), type, message, transaction (a Transaction), isSuccess() (code is 0000) and isBusinessFailure() (code is 9999). Flutter and React Native receive it as a map with the keys code, type, message, transaction_history, force_reconciliation (1: the SDK starts a reconciliation), download_parameter (1: the SDK downloads the terminal configuration again) and initialKey. The Transaction fields used most often:
On docs.edfapay.com
Every payment also appears in the dashboard: Transactions.
| Field (Kotlin; Java getter) | Map key (Flutter, React Native) | Type | Description |
|---|---|---|---|
| rrn | rrn | String? | Retrieval Reference Number |
| transactionNumber | transaction_number | String? | Transaction id |
| amount | amount | String | Transaction amount |
| currency | currency | String? | Transaction currency; Flutter and React Native receive the ISO 4217 numeric code, for example 682 for SAR |
| status | status | String | Transaction status from the server |
| authCode | auth_code | String? | Authorization code |
| cardNumber | credit_number | String | Masked card number (e.g. **** **** **** 1234) |
| cardholderName | cardholder_name | String? | Name on the card |
| operationType | operation_type | String? | Operation name from the server; transactionType() returns it as a TransactionType (Kotlin, Java) |
| createdDate | created_date | String | Creation date as sent by the server |
| finishDate | finish_date | String? | Finish date as sent by the server |
| responseMessageCode | response_message_code | String? | Response code from the server |
| qrData | qr_data | String? | QR code data for the receipt (nullable) |
On this page
Downloads
Coming SoonSample apps, release bundles, and more content will be available here soon.