multivendor-payglocal
v0.0.4
Published
Framework-agnostic PayGlocal SDK wrapper for PayCollect, status, callbacks, webhooks, and refunds
Maintainers
Readme
multivendor-payglocal
Framework-agnostic PayGlocal SDK wrapper for PayCollect hosted checkout, status polling, callbacks, webhooks, and refunds. Callback verification uses an RS256 algorithm allowlist.
Install
npm install multivendor-payglocalUsage
import { PayglocalClient } from 'multivendor-payglocal';
const client = new PayglocalClient({
merchantId: process.env.PAYGLOCAL_MERCHANT_ID!,
privateKeyKid: process.env.PAYGLOCAL_PRIVATE_KEY_KID!,
privateKey: fs.readFileSync('keys/payglocal-private.pem', 'utf8'),
publicKeyKid: process.env.PAYGLOCAL_PUBLIC_KEY_KID,
publicKey: fs.readFileSync('keys/payglocal-pubcert.pem', 'utf8'),
baseUrl: 'https://api.uat.payglocal.in',
});
const session = await client.initiatePayCollect({
merchantTxnId: 'order_12345_uuid',
amount: 15,
currency: 'USD',
merchantCallbackURL: 'https://api.example.com/customer/payglocal/callback',
merchantUniqueId: '12345',
billingData: {
firstName: 'John',
lastName: 'Denver',
emailId: '[email protected]',
callingCode: '+91',
phoneNumber: '9008018469',
addressStreet1: 'Test123',
addressCity: 'Bangalore',
addressState: 'Karnataka',
addressPostalCode: '560094',
addressCountry: 'IND',
},
riskData: {
shippingData: {
firstName: 'John',
lastName: 'Denver',
emailId: '[email protected]',
callingCode: '+91',
phoneNumber: '9008018469',
addressStreet1: 'Test123',
addressStreet2: 'Punctuality lane',
addressCity: 'Bangalore',
addressState: 'Karnataka',
addressPostalCode: '560094',
addressCountry: 'IND',
},
orderData: [
{
productDescription: 'Product name',
productSKU: 'SKU-001',
itemUnitPrice: '15.00',
itemQuantity: '1',
},
],
},
});
// Redirect customer to session.redirectUrlriskData.shippingData is required for international card flows and global alternative payment methods on PayCollect hosted checkout.
See docs/PREFLIGHT.md for rollout assumptions.
License
MIT
