EdfaPay Logo

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).

Transaction Flow

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

CAPTUREFor Authorize paths
REVERSE / VOIDFor cancellations

4. Settlement & Finality

End-of-day reconciliation pushes funds to your merchant account.

Post-Settlement Refund

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:

OperationFunctionoriginalTransactionPIN always requested
Purchasepurchase()NoneNo
Authorize (hold funds), coming soonauthorize()NoneNo
Capture, coming sooncapture()Required: the AUTHORIZE transactionNo
Refundrefund()Required: the PURCHASE transactionNo
ReversereverseLastTransaction()Not used: it reverses the last transaction the SDK storedNo
Change PIN, coming soonchangePin() (see Card Management)NoneYes
Card activation, coming soonactivateCard() (see Card Management)NoneYes

Flow Types

FlowType controls the screens the SDK shows after the card is read, and how often onPaymentProcessComplete is called. The default is DETAIL.

FlowTypeDescriptionUse Case
FlowType.IMMEDIATEThe 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.STATUSShows 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.DETAILShows 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.

Authorize (Pre-Authorization)Coming soon

Coming soon. Authorize holds funds on the card without taking them, for example for a hotel booking or a car rental; capture() takes the held amount later.

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).

PaymentMethodSerialized ValueFlow
TAMARAtamaraBNPL via Tamara (pay by instalments)
TABBYtabbyBNPL via Tabby (pay by instalments)
CHECKOUTcheckoutPayment-gateway checkout link
CONTACTLESScontactlessSoft 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.

FieldKotlinFlutter / React NativeNotes
orderIdString, requiredNot a parameter; pass orderNumberYour order reference
orderNumberNot a parameter (accepted as the key for orderId)RequiredYour order number
paymentMethodPaymentMethod, requiredRequiredTAMARA, TABBY or CHECKOUT
amountLong, requiredNumber, requiredSent unchanged; the samples use minor units (15000 for 150.00)
currencyString, requiredRequiredFor example SAR
phoneNumberString, requiredRequiredCustomer phone number
emailString, requiredRequiredCustomer email
paymentTypeString, requiredOptional (default PAY_BY_INSTALMENTS)The SDK replaces it with the value for paymentMethod
additionalDataAdditionalData(storeId), requiredAdditionalData(storeId), requiredStore id
invoiceInvoice, optionalInvoice(total, lineItems), requiredInvoice total and line items
localeString, optional (default en_US)Optional (default en_US)-
customerDetails, address, descriptionOptionalNot available-
merchantId, orderReferenceIdNot in the Kotlin requestRequired-

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)TypeDescription
rrnrrnString?Retrieval Reference Number
transactionNumbertransaction_numberString?Transaction id
amountamountStringTransaction amount
currencycurrencyString?Transaction currency; Flutter and React Native receive the ISO 4217 numeric code, for example 682 for SAR
statusstatusStringTransaction status from the server
authCodeauth_codeString?Authorization code
cardNumbercredit_numberStringMasked card number (e.g. **** **** **** 1234)
cardholderNamecardholder_nameString?Name on the card
operationTypeoperation_typeString?Operation name from the server; transactionType() returns it as a TransactionType (Kotlin, Java)
createdDatecreated_dateStringCreation date as sent by the server
finishDatefinish_dateString?Finish date as sent by the server
responseMessageCoderesponse_message_codeString?Response code from the server
qrDataqr_dataString?QR code data for the receipt (nullable)