@cometh/checkout
v1.0.1
Published
Cometh Checkout SDK
Downloads
49
Keywords
Readme
Connect Checkout SDK
Installing Checkout SDK
npm install @cometh/checkout-sdk
Basic Usage
- Initialize SDK
import {CheckoutSDK} from '@cometh/checkout'
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, CheckoutEvents} from '@cometh/checkout'
const sdk = new CheckoutSDK(apiKey)
sdk.on(CheckoutEvents.START, () => {
console.log('display is ON and flow has started');
});
sdk.on(CheckoutEvents.SUCCESS, (result: CheckoutSuccess) => {
});
sdk.on(CheckoutEvents.FAILURE, (error: CheckoutError) => {
});