payos-checkout
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Instructions for using the Payos-Checkout library for Payos integrated applications

This library will help you open payment links or payment pop ups on React JS applications

1. Installation

Make sure you have the payos-checkout library installed

     npm install payos-checkout

2. Initialization

import { usePayOS, PayOSConfig } from "payos-checkout";

const payOSConfig: PayOSConfig = {
  RETURN_URL: "YOUR_RETURN_URL",
  ELEMENT_ID:
    "YOUR_ELEMENT_ID is the id of the div element will contain the payment interface",
  CHECKOUT_URL: "YOUR_CHECKOUT_URL is the payment Link id",
  embedded: true, // if use embedded payment interface
  onSuccess: (event: any) => {
    //TODO: Action when the order is successfully paid
  },
  onExit: (event: any) => {
    //TODO: Action when the user clicks to exit the checkout
  },
  onCancel: (event: any) => {
    //TODO: Action when the user clicks to cancel order
  },
};

const { exit, open } = usePayOS(payOSConfig);

3. How to use

  • Function open(): Will open the payment interface as a pop up or embedded in the page
  • Function exit(): Will close the payment interface

Parameters in events:

{
  status: string;
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.863latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.863
1.0.720
1.0.60
1.0.513
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i payos-checkout

Weekly Downloads

96

Version

1.0.8

License

ISC

Unpacked Size

6.81 kB

Total Files

4

Last publish

Collaborators

  • hieunt0303
  • khanhnguyenminh
  • locbt-casso