4.4.3 • Published 8 months ago

@0xsequence/kit-checkout v4.4.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 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.4.1

8 months ago

4.4.3

8 months ago

4.4.2

8 months ago

4.4.0

8 months ago

4.0.5

9 months ago

4.0.6

9 months ago

4.3.2

9 months ago

4.3.1

9 months ago

4.3.0

9 months ago

4.2.0

9 months ago

4.1.0

9 months ago

4.0.4

9 months ago

4.0.1

10 months ago

4.0.0

10 months ago

4.0.3

10 months ago

4.0.2

10 months ago

2.11.0

11 months ago

2.11.1

11 months ago

2.8.1

1 year ago

2.8.0

1 year ago

2.9.2

12 months ago

2.9.1

12 months ago

2.11.4

10 months ago

2.11.2

11 months ago

2.11.3

10 months ago

2.10.1

11 months ago

2.10.0

11 months 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

10 months ago

2.9.0

12 months ago

2.8.11

12 months 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

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5-beta.12

1 year ago

2.0.5-beta.14

1 year ago

2.0.5-beta.13

1 year ago

2.0.5-beta.11

1 year ago

2.0.5-beta.10

1 year ago

2.0.5-beta.9

1 year ago

2.0.5

1 year ago

2.0.5-beta.8

1 year ago

2.0.5-beta.5

1 year ago

2.0.5-beta.4

1 year ago

2.0.5-beta.7

1 year ago

2.0.5-beta.6

1 year ago

2.0.5-beta.3

1 year ago

2.0.4

1 year ago

2.0.5-beta.1

1 year ago

2.0.5-beta.2

1 year ago

2.0.4-beta.1

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0-beta.2

1 year ago

2.0.0

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.12

1 year 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