0.5.0-beta • Published 16 days ago

@checkout.com/checkout-web-components v0.5.0-beta

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

Checkout Web Components Loader

License: MIT

Loader for Checkout Web Components.


Table of contents


Installation

Use npm to install the package.

npm install @checkout.com/checkout-web-components

Usage

The loadCheckoutWebComponents function is the entry point for the library.

The function returns a Promise resolving with a CheckoutWebComponents instance, and handles loading the Checkout Web Components script. This instance can then be used to create a Flow component that can be mounted.

import { loadCheckoutWebComponents } from '@checkout.com/checkout-web-components';

Example

// Insert your public key here
const publicKey = '{your_public_key}';

// Initialise a new Checkout Web Components instance
const checkout = await loadCheckoutWebComponents({
  paymentSession,
  publicKey,
  environment: 'sandbox'
});

// You can now create and mount a Flow component using 'checkout'
const flowComponent = checkout.create('flow');

// Mount Flow component to div element with an ID of 'flow-container'
flowComponent.mount('#flow-container');

You can find/create your public key in the Developers section of your Checkout.com Production Dashboard or Checkout.com Sandbox Dashboard. See our API keys documentation for more information.


License

This project is licensed under the MIT License.

0.5.0-beta

16 days ago

0.4.0-beta

18 days ago

0.3.0-beta

1 month ago

0.2.0-beta

3 months ago

0.1.0-beta

7 months ago