Handling Receipts
You can decide to either handle your own receipt screen implementation or allow the SDK to provide a base for you where you can implement specific functionality which then should be handled in your app.
This is done by providing a receipt delegate as part of the PaymentParameters
and/or PaymentParameters
which will cause the SDK to render a receipt screen that will be handled using the ReceiptDelegate
.
If no delegate is provided, then the SDK will skip receipt screen and return after the completion screen. This will allow you to provide your own receipt screen implementation or do nothing.
Step 1: Implement the Receipt Delegate
You will need to implement the ReceiptDelegate
to listen for callbacks from the receipt screen
Step 2: Register the Delegate
You will need to pass the ReceiptDelegate
to the SDK as part of the PaymentConfig
Step 3: Implement Optional functions
To get notified of the receipt button presses from the receipt screen (Provided by the SDK), you will need to implement the callback functions that is linked to the ReceiptType
that you have specified in the supportedReceiptTypes()
function.
Supported Receipt Types
Receipt Type | Value | Callback |
---|---|---|
Sms | ReceiptType.SMS | sendSMSReceipt(number: String, paymentResult: PaymentResult, progress: UpdateReceiptProgress) |
ReceiptType.EMAIL | sendEmailReceipt(address: String, paymentResult: PaymentResult, progress: UpdateReceiptProgress) | |
ReceiptType.PRINT | printReceipt(paymentResult: PaymentResult, progress: UpdateReceiptProgress) |
It is up to you to decide how the receipt is handled. In each callback, it will provide you with a progress
parameter - this allows you to control the receipt screen's selected button state.
It will also provide the current PaymentResult with the info related to the transaction result.
Receipt State
The receipt state can be changed multiple times, as long as you keep calling the state using the progress parameter. Each state represents a view change for the specific button [Incomplete (default), In progress, Error, Complete]