4.6.5 • Published 7 months ago

@0xsequence/kit-checkout v4.6.5

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

Sequence Kit Checkout

Checkout modal for Sequence Kit. Displays a list a summary of collectibles to be purchased

Installing the module

First install the package:

npm install @0xsequence/kit-checkout
# or
pnpm install @0xsequence/kit-checkout
# or
yarn add @0xsequence/kit-checkout

Then the wallet provider module must placed below the Sequence Kit Core provider.

import { KitCheckoutProvider } from '@0xsequence/kit-checkout'

const App = () => {
  return (
    <SequenceKit config={config}>
      <KitCheckoutProvider>
        <Page />
      </KitCheckoutProvider>
    </SequenceKit>
  )
}

Open the checkout modal

The useCheckoutModal hook must be used to open the modal. Furthermore, it is necessary to pass a settings object.

  import { useCheckoutModal } from '@0xsequence/kit-checkout'


  const MyComponent = () => {
    const { triggerCheckout } = useCheckoutModal()

    const onClick = () => {
      const checkoutSettings = {...}
      triggerCheckout(checkoutSettings)
    }

    return (
      <button onClick={onClick}>checkout</button>
    )
  }

Configuration

The react example has an example configuration for setting up the checkout.

Example settings

const checkoutSettings = {
  creditCardCheckout: {...},
  cryptoCheckout: {...},
  orderSummaryItems: {...}
}

cryptoCheckout

The cryptoCheckout specifies settings regarding checking out with crypto. An example usecase might be interacting with a minting contract.

The actual cryptoTransaction must be passed down to triggerCheckout.

const checkoutConfig = {
  {...},
  cryptoCheckout: {
    chainId: 137,
    triggerTransaction: async () => { console.log('triggered transaction') },
    coinQuantity: {
      contractAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
      amountRequiredRaw: '10000000000'
    },
  },
}

creditCardCheckout

The creditCardCheckout field specifies settings regarding checking out with credit card.

triggerCheckout must be called in order to open the checkout modal.

const creditCardCheckout = {
  {...},
  cryptoCheckout: {
      defaultPaymentMethodType: 'us_debit',
      onSuccess: (hash) => { console.log('credit card checkout success', hash) },
      onError: (e) => { console.log('credit card checkout error', e) },
      chainId,
      contractAddress: orderbookAddress,
      recipientAddress,
      currencyQuantity: '100000',
      currencySymbol: 'USDC',
      currencyAddress: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
      currencyDecimals: '6',
      nftId: checkoutTokenId,
      nftAddress: checkoutTokenContractAddress,
      nftQuantity,
      isDev: true,
      calldata: getOrderbookCalldata({
        orderId: checkoutOrderId,
        quantity: nftQuantity,
        recipient: recipientAddress
      })
  },
}

orderSummaryItems

This field specific the list of collectibles that will show up in the order summary.

orderSummaryItems: [
  {
    contractAddress: '0x631998e91476da5b870d741192fc5cbc55f5a52e',
    tokenId: '66597',
    quantityRaw: '100'
  }
]

Open the Add Funds by Credit Card Modal

Kit allows users to buy cryptocurrencies using credit card. Calling the triggerAddFunds function will cause a modal to appear.

import { useAddFundsModal } from '@0xsequence/kit-checkout'

const MyComponent = () => {
  const { triggerAddFunds } = useAddFundsModal()

  const onClick = () => {
    triggerAddFunds({
      walletAddress: recipientAddress
    })
  }

  return <button onClick={onClick}>Add Funds</button>
}
4.5.8

9 months ago

4.5.7

9 months ago

4.5.9

8 months ago

4.5.4

9 months ago

4.5.3

10 months ago

4.5.6

9 months ago

4.5.5

9 months ago

4.4.5

10 months ago

4.4.4

11 months ago

4.4.6

10 months ago

4.6.3-beta.1

8 months ago

4.6.3-beta.0

8 months ago

4.6.1

8 months ago

4.6.0

8 months ago

4.6.6-beta.0

7 months ago

4.6.3

8 months ago

4.6.2

8 months ago

4.6.5

7 months ago

4.6.4

7 months ago

4.5.4-beta.0

10 months ago

4.5.0

10 months ago

4.6.3-beta.3

8 months ago

4.5.2

10 months ago

4.6.3-beta.2

8 months ago

4.5.1

10 months ago

4.4.1

11 months ago

4.4.3

11 months ago

4.4.2

11 months ago

4.4.0

12 months ago

4.0.5

1 year ago

4.0.6

1 year ago

4.3.2

12 months ago

4.3.1

1 year ago

4.3.0

1 year ago

4.2.0

1 year ago

4.1.0

1 year ago

4.0.4

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

2.11.0

1 year ago

2.11.1

1 year ago

2.8.1

1 year ago

2.8.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.11.4

1 year ago

2.11.2

1 year ago

2.11.3

1 year ago

2.10.1

1 year ago

2.10.0

1 year ago

2.7.0

1 year ago

2.8.3

1 year ago

2.8.2

1 year ago

2.8.5

1 year ago

2.8.4

1 year ago

2.8.7

1 year ago

2.8.6

1 year ago

2.8.9

1 year ago

2.8.8

1 year ago

3.0.0

1 year ago

2.9.0

1 year ago

2.8.11

1 year ago

2.8.10

1 year ago

2.6.1

1 year ago

2.6.0

1 year ago

2.5.0

1 year ago

2.5.1

1 year ago

2.4.4

1 year ago

2.4.3

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.4.2

1 year ago

2.3.0

1 year ago

2.2.2

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.1

1 year ago

2.1.1-beta

1 year ago

2.1.1-beta.1

1 year ago

2.0.8-beta.2

1 year ago

2.1.0

1 year ago

2.0.8-beta

1 year ago

2.0.8-beta.1

1 year ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5-beta.12

2 years ago

2.0.5-beta.14

2 years ago

2.0.5-beta.13

2 years ago

2.0.5-beta.11

2 years ago

2.0.5-beta.10

2 years ago

2.0.5-beta.9

2 years ago

2.0.5

2 years ago

2.0.5-beta.8

2 years ago

2.0.5-beta.5

2 years ago

2.0.5-beta.4

2 years ago

2.0.5-beta.7

2 years ago

2.0.5-beta.6

2 years ago

2.0.5-beta.3

2 years ago

2.0.4

2 years ago

2.0.5-beta.1

2 years ago

2.0.5-beta.2

2 years ago

2.0.4-beta.1

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0-beta.2

2 years ago

2.0.0

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.10

2 years ago

1.0.2

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago