@baumdigital/greenpay-helper
v1.0.0
Published
Baum Digital - Integración GreenPay
Downloads
38
Readme
Baumdigital - greenpay helper
Ejemplo uso:
const credentials = {
secret: process.env.GREENPAY_SECRET,
merchantID: process.env.GREENPAY_MERCHANT_ID,
terminal: process.env.GREENPAY_TERMINAL,
publicKey: process.env.GREENPAY_PUBLIC_KEY,
currency: process.env.GREENPAY_CURRENCY
};
//Optional
const apiEndpoints = {
paymentWithToken: "https://sandbox-merchant.greenpay.me/tokenPayment",
getRequestToken: "https://sandbox-merchant.GreenPay.me/tokenize",
getCardToken: "https://sandbox-checkout.greenpay.me/tokenize",
createSubscription: "https://sandbox-merchant.greenpay.me/subscriptions",
cancelSubscription:
"https://sandbox-merchant.greenpay.me/subscriptions/cancel",
listSubscriptions: "https://sandbox-merchant.greenpay.me/subscriptions/list",
updateCardTokenSubscription:
"https://sandbox-merchant.greenpay.me/subscriptions/update/card_token",
updateSubscriptionAmount:
"https://sandbox-merchant.greenpay.me/subscriptions/update",
subscriptionManualPayment:
"https://sandbox-merchant.greenpay.me/subscriptions/pay",
listSubscriptionsPayments:
"https://sandbox-merchant.greenpay.me/subscriptions/list/payments"
};
const {
Payment,
Card,
Subscription,
Webhook
} = require("@baumdigital/greenpay-helper");
/*
payment.paymentWithCardToken
*/
const payment = new Payment(credentials, apiEndpoints);
/*
card.getRequestToken
card.getCardToken
card.createCardToken
*/
const card = new Card(credentials, apiEndpoints);
/*
subscription.createSubscription
subscription.cancelSubscription
subscription.listSubscriptions
subscription.updateSubscriptionCardToken
subscription.updateSubscriptionAmount
subscription.subscriptionManualPayment
subscription.listSubscriptionsPayments
*/
const subscription = new Subscription(credentials, apiEndpoints);
/*
webhook.validateWebhookRequest
*/
const webhook = new Webhook(credentials, apiEndpoints);