1.2.3 • Published 2 years ago

typescript-react-coinbase-commerce v1.2.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

typescript-react-coinbase-commerce

TypeScript rewrite of react-coinbase-commerce (unmaintained as of writing). This is my first attempt at making a typescript and react component library. As such I am thankful for any contributions to this repository.

Installation

Install the component using your favorite package manager.

pnpm i typescript-react-coinbase-commerce
# OR
yarn add typescript-react-coinbase-commerce
# OR
npm i typescript-react-coinbase-commerce

Usage/Examples

import { CoinbaseCommerceButton } from "typescript-react-coinbase-commerce";

function App() {
  return (
    <CoinbaseCommerceButton
      styled
      checkoutId="checkout-id-from-coinbase-commerce-dashboard"
    />
  );
}

API Reference

CoinbaseCommerceButton

Below are additional types that are added on top of the regular <button> component.

ParameterTypeRequiredDefaultDescription
checkoutIdstringYes, if no chargeIdnullCheckout ID from Coinbase Dashboard
chargeIdstringYes, if no checkoutIdnullCharge ID generated from Coinbase API
buttonRefReact.RefObjectNonullRef to the underlying <button> component
frameRefReact.RefObjectNonullRef to the underlying <iframe> component
customMetadatastringNonullAdditional metadata passed to checkout
onChargeSuccess(MessageData)=>voidNonullOn payment success
onChargeFailure(MessageData)=>voidNonullOn payment failure
onPaymentDetected(MessageData)=>voidNonullOn payment detected
onModalClosed()=>voidNonullWhen the checkout popover is closed
disableCachingbooleanNofalseIf cache will be saved when the checkout was clicked off without cancelling

Warning: If disableCaching is set to true, users that accidentally close their payment windows will be unable to see their transaction's status upon reopening.

License

Apache-2.0

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2-alpha.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago