0.2.0-beta • Published 7 months ago

checkout-web-components v0.2.0-beta

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months 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-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 PaymentComponents that can be mounted.

import { loadCheckoutWebComponents } from 'checkout-web-components';

Example

const cko = await loadCheckoutWebComponents({
  publicKey: 'pk_XXXXXX',
  paymentSession,
  environment: 'sandbox'
});

// You can now create and mount a payment component using 'cko'
const paymentsComponent = cko.create('payments');

// Mount payments component to div with an id of 'payments'
paymentsComponent.mount('#payments');

Replace the example pk_XXXXXX value with your own public key. You can find 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.2.0-beta

7 months ago

0.1.0-beta

7 months ago