@cometh/checkout-react
v1.1.0
Published
Cometh Checkout SDK for React
Downloads
13
Keywords
Readme
Connect Checkout SDK
Installing Checkout SDK
npm install @cometh/checkout-react
Basic Usage
- Initialize SDK
import {useCheckout} from '@cometh/checkout-react'
const {startCheckout, success, error} = useCheckout(apiKey)
- Start checkout flow
const request = {
productId: 1,
user: {
walletAddress: '0x1234567890',
email: '[email protected]'
}
}
await startCheckout(request)
- Handle Results
import {useEffect} from "react";
useEffect(() => {
if (success) {
console.log('checkout success', success)
}
if (error) {
console.log('checkout error', error)
}
}, [success, error]);