Handling receipts
If you wish to show your own receipt handling view after a payment is complete, then you do not need to implement this delegate. By default if you do not implement the delegate the receipt screen in the YocoSDK will not show. Implement the completion handler as part of the Yoco.charge()
to be notified when the payment is complete and you can then show your own screen.
Step 1: Implement Protocol
You will need to inherit from the YocoReceiptDelegate to be able to listen for callbacks from the receipt screen.
Step 2: Implement Optional functions
To get notified of the receipt buttons being pressed inside the YocoSDK, you will need to implement the callback function that is appropriate to the SupportedReceiptType
that you had specified in the supportedReceiptTypes()
function. It is up to you to decide how the receipt is handled. Here is an example of one type of receipt being handled.
We can see in this example the use of the progress
parameter. This allows you to control the receipt screen's button's state. You can call this function multiple times and must be called on the main thread. The list of states the button can be in are defined here:
Step 3: Register the delegate
You will need to pass the YocoReceiptDelegate
to the YocoSDK as part of the Config.
You now should have everything you need to handle receipts!