npm install @cometh/checkout-sdk
- Initialize SDK
import {CheckoutSDK} from '@cometh/checkout-sdk'
const sdk = new CheckoutSDK(apiKey)
- Start checkout flow
const request = {
productId: 1,
user: {
walletAddress: '0x1234567890',
email: '[email protected]'
}
}
await sdk.checkout(request)
- Handle flow events
import {CheckoutSDK, CheckoutError, CheckoutSuccess} from '@cometh/checkout-sdk'
const sdk = new CheckoutSDK(apiKey)
sdk.on('start', () => {
console.log('display is ON and flow has started');
});
sdk.on('success', (result: CheckoutSuccess) => {
});
sdk.on('failure', (error: CheckoutError) => {
});