1.0.0 • Published 4 years ago

@baumdigital/greenpay-helper v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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);
1.0.0

4 years ago

0.2.3

4 years ago

0.2.4

4 years ago

0.1.3

4 years ago

0.0.3

4 years ago

0.0.2

5 years ago

0.0.1

5 years ago