PaymentResultCallbackfor Android.PaymentResultfor iOS.
Payment Callback
See the code block below for an example of the callback interface.- Successful Transaction (
onPaymentComplete/.complete): This indicates that the payment process was completed, and the billing provider approved the transaction. - Transaction Failure (
onPaymentFail/.fail): This signifies that the transaction failed due to an issue originating from the Drop-In UI or the billing provider’s side, but not a general SDK error. - General Error (
onError/.error): This indicates that a more general error occurred during the transaction process, which might be related to the SDK’s internal state, network issues, or authentication problems.
Result Data Structures
The callback will return a data structure containing information related to the payment, depending on its outcome. See the sections below.PaymentCompleteData
The PaymentCompleteData data structure is received when a payment is successful and contains the following information:
| Parameter | Description |
|---|---|
merchantTranId | The unique merchant transaction identifier. |
sessionId | The session ID associated with the payment. |
tokenId | The token ID. |
resultCode | Result code from the payment processor. |
PaymentFailData
The PaymentFailData data structure is received when a payment fails and contains the following information:
| Parameter | Description |
|---|---|
merchantTranId | The unique merchant transaction identifier. |
sessionId | The session ID for the payment. |
reason | Failure reason (user cancellation, refusal, etc.). |
Error Types
The SDK provides several error types to help diagnose issues during a transaction. You can find them in the table below:| Error Type | Description | Examples |
|---|---|---|
EcomSdkError | Errors related to the SDK lifecycle. | not initialized |
PaymentError | Errors that occur during a payment. | AuthFailed, Timeout, NetworkError, GeneralError |
DropInFailureReason | Specific errors related to the payment checkout. | CanceledByUser, Refused |