4.0.0 • Published 9 months ago

@confirmo/overlay v4.0.0

Weekly downloads
2
License
-
Repository
-
Last release
9 months ago

Confirmo

npm

npm install @confirmo/overlay

yarn

yarn add @confirmo/overlay

CDN

<script src="https://cdn.jsdelivr.net/npm/@confirmo/overlay@4.0.0/dist/confirmo.js"></script>

Overlay

Bundlers

import { Invoice } from '@confirmo/overlay';

/**
 * Opens Confirmo invoice overlay
 *
 * @param {string} invoice_url - URL of invoice.
 * @param {callback} [callback_fnc] - Optional - callback which is called when overlay was closed
 *
 * @example
 *
 * // URL of invoice created from REST API
 * const invoice_url = 'https://confirmo.demo/#/public/invoice/invv9e1rxdz8';
 *
 * // Callback which is called when overlay was closed
 * const callback_fnc = () => alert('Overlay has been closed');
 */
const overlay = Invoice.open(invoice_url, callback_fnc);

/**
 * Closes Confirmo invoice overlay
 */
overlay.close();

Script Tag

<script>
  const overlay = Confirmo.Invoice.open(invoice_url, callback_fnc);

  overlay.close();
</script>

Payment button

HTML

<div id="placeholder-for-button"></div>

Bundlers

import { PaymentButton } from '@confirmo/overlay';

/**
 * Creates Confirmo payment button
 */
const button = PaymentButton.initialize(
  {
    id: 'placeholder-for-button',
    paymentButtonId: 'pbt16354asde',
    buttonType: 'SIMPLE',
    values: {
      productName: 'Some cool product',
      productDescription: 'Simple description',
      reference: 'merchantRef',
      returnUrl: 'https://my-cool-eshop.com/?q=this+is+return+url',
    },
  },
  () => {
    console.log('Overlay has been closed!');
  }
);

/**
 * Removes Confirmo payment button
 */
button.remove();

Script Tag

<script>
  const button = Confirmo.PaymentButton.initialize(
    {
      id: 'placeholder-for-button',
      paymentButtonId: 'pbt16354asde',
      buttonType: 'SIMPLE',
      values: {
        productName: 'Some cool product',
        productDescription: 'Simple description',
        reference: 'merchantRef',
        returnUrl: 'https://my-cool-eshop.com/?q=this+is+return+url',
      },
    },
    () => {
      console.log('Overlay has been closed!');
    }
  );

  button.remove();
</script>
4.0.0

9 months ago

3.2.0

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago