@cometh/checkout
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Connect Checkout SDK

Installing Checkout SDK

npm install @cometh/checkout-sdk

Basic Usage

  1. Initialize SDK
import {CheckoutSDK} from '@cometh/checkout'

const sdk = new CheckoutSDK(apiKey)
  1. Start checkout flow
const request = {
    productId: 1,
    user: {
        walletAddress: '0x1234567890',
        email: 'test@email.com'
    }
}

await sdk.checkout(request)
  1. 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) => {
});

Readme

Keywords

none

Package Sidebar

Install

npm i @cometh/checkout

Weekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

19.8 kB

Total Files

6

Last publish

Collaborators

  • yoanslvy
  • shoto290
  • jb-cometh
  • fred-alembic
  • kevin-cometh
  • athomasnc