Refund a WollettePay payment
Use refund for a full or partial refund. Supply the original payment's server request ID and acquire payment data again through NFC or Bluetooth.
Prepare the refund
Your app must:
- Find the original authorised payment and its
requestId. - Check refund eligibility and the remaining refundable amount.
- Create or restore a distinct host refund flow.
- Resolve any retained SDK operation before starting another.
- Supply the merchant session, terminal, usable key and required permissions.
originalPaymentRequestId is the original payment request ID. It is not the order ID, the original idempotency ID or a previous refund request ID.
Submit a full or partial refund
val request = PosPaymentRequest(
orderId = orderId,
amount = MonetaryAmount(value = refundAmount, currencyCode = currencyCode),
location = PosLocation(lat = latitude, lon = longitude),
)
val result = withContext(Dispatchers.IO) {
sdk.refund(
request,
originalPaymentRequestId,
AndroidPosNfcReader(foregroundActivity),
)
}Use the original payment's applicable currency and the approved refund amount. The SDK validates basic input shape; your app owns refund limits and business eligibility.
For Bluetooth, pass the same configured coordinator through the coordinator overload. Both overloads retain the original payment ID in the refund signature and payload.
Record and complete
Handle the same six statuses as payments. Persist the result against your host refund flow. An authorised refund is separate from completing the host's refund/order workflow.
Acknowledge only a definitive result after durable recording prevents duplicate initiation. Retain pending, timed-out or unknown submitted operations for recovery.
Distinguish repeated partial refunds
Two legitimate partial refunds may have the same amount and original payment ID. Give each a distinct identity in your app's durable flow state.
While the SDK retains the previous result, an identical intent returns that result. After acknowledgement, the same request can create a new operation with a new UUID. Your app must distinguish an intentional second refund from retrying a completed flow.
If a refund response is lost, recover the saved operation. Do not create a fresh refund merely because the app did not receive the first result.
Verify the refund flow
Use a distinct host refund checkout and the original payment request ID. Keep the refund's operation/idempotency ID separate from both.
| Scenario | Expected result |
|---|---|
| Definitive refund result | Save it against the refund flow before acknowledgement |
| Pending/unknown refund | Recover the original refund operation; do not submit a replacement |
| Result saved, host refund completion fails | Resume host completion without initiating another refund |
| Full or partial refund | Host validates eligibility, original amount and remaining refundable amount |
| Missing original payment request ID | Resolve it from the host's original payment receipt before calling the SDK |
The POS starter apps contain the native call and retained-operation handling. They do not replace your refund-eligibility or completion service. See refund.
Record refund acceptance
Use approved original-payment fixtures and exact full/partial refund amounts. The original payment request ID is different from the order ID and the new refund's idempotency ID. Store that relationship in the host receipt.
Repeat one interrupted refund flow using its retained operation and verify that it does not create a second refund. Distinct partial refunds need distinct host flows and remaining-amount checks. Record observed SDK status, host completion and financial request count in the acceptance CSV.
Use the original payment/account currency and approved refund amount policy. The core money model has two-place HALF_UP rounding; it does not define every provider conversion or refund eligibility rule. Confirm those rules with the payments owner.