Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@medipass/checkout-sdk

Package Overview
Dependencies
Maintainers
8
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medipass/checkout-sdk

Describe medipass-checkout-sdk here

  • 2.0.1
  • npm
  • Socket score

Version published
Weekly downloads
59
increased by247.06%
Maintainers
8
Weekly downloads
 
Created
Source

Medipass Checkout SDK

The Medipass Checkout SDK is a client-side JavaScript library which allows you to interact with Medipass from your web interface.

Table of Contents

Install

yarn add @medipass/checkout-sdk

or NPM:

npm install @medipass/checkout-sdk

Basic Usage

import medipassCheckoutSDK from '@medipass/checkout-sdk';
// or: const medipassCheckoutSDK = require('@medipass/checkout-sdk');

medipassCheckoutSDK.init({
  env: 'stg',
  onSuccess: ({ transactionId }) => {
      // handle success
  },
  onFailure: ({ transactionId }) => {
      // handle failure
  },
  onCancel: ({ transactionId }) => {
      // handle cancel
  },
  onClose: () => {
      // handle close
  }
});

const paymentRequestUrl = getPaymentRequestUrl();

medipassCheckoutSDK.createCheckout({
  paymentRequestUrl // the paymentRequestUrl returned after creating a Medipass invoice
});

With a <script> tag

<html>
  <head>
    <script src="https://unpkg.com/@medipass/checkout-sdk/umd/@medipass/checkout-sdk.min.js"></script>
  </head>
  <body>
    <script>
      medipassCheckoutSDK.init({
        env: 'stg',
        onSuccess: ({ transactionId }) => {
            // handle success
        },
        onFailure: ({ transactionId }) => {
            // handle failure
        },
        onCancel: ({ transactionId }) => {
            // handle cancel
        },
        onClose: () => {
            // handle close
        }
      });

      const paymentRequestUrl = getPaymentRequestUrl();

      medipassCheckoutSDK.createCheckout({
        paymentRequestUrl // the paymentRequestUrl returned after creating a Medipass invoice
      });
    </script>
  </body>
</html>

API

sdk.init(config)

config

Object | required

{
  env: 'stg' | 'prod',
  onSuccess: function({ transactionId }) {}, // Invoked when the payment has been successful
  onFailure: function({ transactionId }) {}, // Invoked when the payment has failed
  onCancel: function({ transactionId }) {}, // Invoked when the payment has been rejected
  onClose: function() {} // Invoked when the pop-up window has been closed by the user before approving or rejecting the payment
}

sdk.createCheckout(config)

config

Object | required

{
  paymentRequestUrl: string,
}

FAQs

Package last updated on 22 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc