1.1.3 • Published 8 months ago

payostest v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Here's a guide to integrating PayOS into your app

Step 1: Assure that you have installed the library

With Npm: npm install payostest With Yarn: yarn add payostest

Step 2: Import the library and initialize your PayOS

    const payOS = require("payostest");
    
    //You can use import instead
    import payOS from "payostest";

    const payosApi = new payOS({
    clientId: "",
    apiKey: "",
    checksumKey:
        "",
    });

Don't forget to fill 3 field: clientId, apiKey and checksumKey from your payos account

Now, you can use

1. Create Payment Link:

    let result = await payosApi.createPaymentLink({
        orderCode: 234234,
        amount: 1000,
        description: "Thanh toan don hang",
        items: [
        {
            name: "Mì tôm hảo hảo ly",
            quantity: 1,
            price: 1000,
        },
        ],
        cancelUrl: "",
        returnUrl: "",
    });

Type:

    PaymentLinkType {
        orderCode: number;
        amount: number;
        description: string;
        items: { name: string; quantity: number; price: number }[];
        cancelUrl: string;
        returnUrl: string;
        signature?: string;
        buyerName?: string;
        buyerEmail?: string;
        buyerPhone?: string;
        buyerAddress?: string;
    }

2. Get Information of Payment:

    let result = await payosApi.getInformationPayment(234234);

Type:

    {orderId: String | Number}

3. Confirm Webhook:

    let result = await payosApi.confirmWebhook({ webhookUrl: "https://1589-14-241-231-139.ngrok-free.app/payment/payos_transfer_handler" });

Type:

    {WebhookUrl: String}
1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago