@payos/node
Advanced tools
+94
| # Documentation for using the *@payos/node* package | ||
| ## Step 1: Assure that you have installed the library | ||
| With Npm: **npm install @payos/node**\ | ||
| With Yarn: **yarn add @payos/node** | ||
| ## Step 2: Import the library and initialize your PayOS | ||
| * CommonJS | ||
| ```javascript | ||
| const payOS = require("@payos/node"); | ||
| const payosApi = new payOS.default({ | ||
| clientId: "", | ||
| apiKey: "", | ||
| checksumKey: "", | ||
| }); | ||
| ``` | ||
| * ES Modules | ||
| ```javascript | ||
| import payOS from "@payos/node"; | ||
| 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: | ||
| ```javascript | ||
| 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: "https://your-domain.com", | ||
| returnUrl: "https://your-domain.com", | ||
| }); | ||
| ``` | ||
| Type: | ||
| ```javascript | ||
| 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: | ||
| ```javascript | ||
| let result = await payosApi.getInformationPayment(orderId); | ||
| // Example: | ||
| let result = await payosApi.getInformationPayment(1234); | ||
| ``` | ||
| Type: | ||
| ```javascript | ||
| orderId: String | Number | ||
| ``` | ||
| ### 3. Confirm Webhook: | ||
| ```javascript | ||
| let result = await payosApi.confirmWebhook({ | ||
| webhookUrl: "https://your-domain.com/payment/payos_transfer_handler" | ||
| }); | ||
| ``` | ||
| Type: | ||
| ```javascript | ||
| { webhookUrl: String } | ||
| ``` |
+5
-2
| { | ||
| "name": "@payos/node", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "", | ||
@@ -20,3 +20,2 @@ "main": "lib/index.js", | ||
| "axios": "^1.5.0", | ||
| "body-parser": "^1.20.2", | ||
| "crypto": "^1.0.1", | ||
@@ -27,3 +26,7 @@ "dotenv": "^16.3.1" | ||
| "@types/node": "^20.5.9" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/payOSHQ/payos-lib-be.git" | ||
| } | ||
| } |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
16548
13.16%3
-25%12
9.09%0
-100%94
Infinity%1
-50%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed