Direct Sale (Headless)
Bypass the bundled UI and drive the sale yourself with EdfaPgSdk.sale(SaleRequest). You supply the order, customer, billing address, invoice, card, and a computed hash; the SDK returns the raw gateway response.
Overview
Headless mode is for apps that already have their own checkout. You capture the card, build a SaleRequest, and call sale(...). Direct (headless) API calls work from any layer — including pure ViewModels — because there is no bundled UI to host.
You become PCI-relevant
Going headless means your app captures raw card data, so you take on PCI scope (SAQ-A-EP). Never log raw PANs. If you'd rather stay out of scope, use the bundled Card Checkout instead.
Calling sale()
sale(...) is a suspend function on Kotlin, async on Swift, and returns a Future on Flutter. Pass the full SaleRequest — order, amount, currency, auth / recurringInit flags, customer, billing address, invoice, result URLs, the computed hash, and the card.
Loading...Response Shape
The response mirrors EdfaPay's gateway response — a JsonObject (Kotlin/Swift) or Map<String, dynamic> (Flutter). Read result / status to branch, and errorCode / errorMessage on failure. See Error Handling for the full pattern.
| Field | Example | Meaning |
|---|---|---|
| result | SUCCESS | Top-level outcome — branch on this first. |
| status | APPROVED | Gateway transaction status. |
| id | a1b2c3d4-…-ef01 | The gateway transaction UUID. |
| orderId | ORDER-1234 | Your merchant order id, echoed back. |
| rrn | 123456789012 | Retrieval Reference Number. |
| errorCode / errorMessage | null / null | Populated when the call fails. |
Idempotency
sale is not idempotent. Always pre-generate your orderId, and before retrying a timed-out sale call getTransactionByOrderId(orderId) to see whether the gateway already booked the charge.
On this page
Downloads
Coming SoonSample apps, release bundles, and more content will be available here soon.