payermax
v1.0.1
Published
PayerMax SDK
Downloads
2
Readme
PayerMax
PayerMax SDK
Installation
npm install payermax --save
# or
yarn add payermax
Documentation
See the PayerMax API for documentation.
Usage
Note: After integrating the SDK, all API interfaces do not need to pass parameter sign、merchantId
const PayerMax = require('payermax');
const payerMax = new PayerMax({
// Secret key (Required)
secretKey: 'Merchant security key',
// Merchant ID (Required)
merchantId: 'Merchant ID assigned by PayerMax',
// Debugging environment: Test or Prod (Optional)
// default: Prod
env: 'Test',
// https configuration (Optional)
// For details, please refer to the NodeJS https chapter
https: {
timeout: 1000
}
});
Payment Service General API
For detailed parameter description, please refer to the document Payment Service
// Example: create a payment order
payerMax.payment.post({
bizType: 'CUSTOMIZE',
orderId: 'order1234456',
userId: 'user123456',
subject: 'shop title',
countryCode: 'ID',
currency: 'IDR',
totalAmount: '1000',
frontCallBackUrl: 'https://www.payermax.com',
version: '2.3',
...params
// merchantId (Optional)
// sign (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Disbursement Service General API
For detailed parameter description, please refer to the document Disbursement Service
payerMax.disbursement.post({
bizType: 'singlePayment',
version: '2.0'
...params
// merchantId (Optional)
// sign (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Specify API
Create a payment order
For detailed parameter description, please refer to the document API
payerMax.payment.create({
bizType: 'According to the authority of the contracted collection service',
...params
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Payment Result Query
For detailed parameter description, please refer to the document API
payerMax.payment.queryReceiptResult({
orderId: 'Merchant order id'
// bizType (Optional)
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Refund
For detailed parameter description, please refer to the document API
payerMax.payment.refund({
refundId: 'Refund request id',
orderId: 'Original merchant order id',
amount: 'Refund amount',
currency: 'Currency code',
callbackUrl: 'Refund result callback URL', // (Optional)
comment: 'Refund comments', // (Optional)
email: 'Email', // (Optional)
// bizType (Optional)
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Refund Result Query
For detailed parameter description, please refer to the document API
payerMax.payment.queryRefundResult({
refundId: 'Refund request id'
// bizType (Optional)
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Create a disbursement order
For detailed parameter description, please refer to the document API
payerMax.disbursement.create({
orderId: 'Merchant order ID',
...params
// bizType (Optional)
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));
Disbursement Result Query
For detailed parameter description, please refer to the document API
payerMax.disbursement.queryResult({
orderId: 'Merchant order ID',
// bizType (Optional)
// merchantId (Optional)
// sign (Optional)
// version (Optional)
})
.then(res => console.log(res))
.catch(err => console.log(err));