Process the Credit Card
The Clearpay Button works with a virtual Visa credit card.
To process the credit card, use the ClearpayButton.onComplete property that allows a custom function to be defined.
Once defined, the custom function is called when the Clearpay checkout is completed. This custom function is passed an event with a data property. This data property contains the virtual card object and status as sub-properties.
All successful Clearpay checkouts have a status of “SUCCESS”.
event.data.status = "SUCCESS".
Recommendation
For the best customer experience, hide the credit card information and auto-submit the order within the onComplete function.
To process the credit card, modify the code sample below to match your credit card fields:
Note
The virtual Visa card must be authorized less than 60 mins after the card is returned to the merchant.
Billing Address
Use the customer’s home address as the billing address for the credit card.
Data Objects
Virtual Card Object
Checkout Tokens
Error Handling
You can add an error handling function to return information about failed checkouts. See the Error Handling for more information.