Callbacks
When instantiating theAzimuthBuyWithCrypto
class, an optional onPaymentSuccessCallback
and onWalletConnectCallback
functions can be passed as parameters to the constructor. Below we detail the structure and possible usage for each of these.
onPaymentSuccessCallback
This function is triggered when a customer successfully completes a transaction and is provided with a JSON-formatted event object containing all the relevant details about the transaction. This enables you to access and manipulate transaction data for delivering acknowledgments, sending customer invoices or credits, or any other customized functionality in your application. The callback function must have a void
type, which means it has a signature of the form(txnDetails) => ()
.
txnDetails
The txnDetails
object passed to the onPaymentSuccessCallback
function upon successful transaction processing is a JSON-formatted object with the following properties:
Where the objects properties are defined as:
onWalletConnectCallback
This function is triggered when a customer successfully connects his wallet into your website and is provided with a JSON-formatted event object containing the connected wallet address. This enables you to both authenticate and identify the customer using his unique wallet address, and by that automate different actions such as presenting the user his current credits count, or any other customized functionality. The callback function must have a void
type, which means it has a signature of the form(walletDetails) => ()
.
walletDetails
The walletDetails
object passed to the onWalletConnectCallback
function upon successful wallet connection is a JSON-formatted object with the following properties:
Where the objects properties are defined as:
Last updated