dexter4life / gp-node-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For globalpayments and those who use to integrate it into their system.

Process a Payment Example

const config = new ServicesConfig();
  config.appKey = "lalala.... find your own";
  config.serviceUrl = "https://apis.sandbox.globalpay.com/ucp";
  config.version = "2021-03-22";
  config.applicationId = "lalala.... find your own";

  ServicesContainer.configure(config);

  const card = new CreditCardData();
  card.number = "4111111111111111";
  card.expiryMonth = "04";
  card.expiryYear = "25";
  card.cvv = "123";
  card.avsAddress = "RD.asd'-' 17's Bogong";
  card.avsPostalCode = "3699";

  const transaction = await card
    .authorize("140")
    .withAccountName("Transaction_Processing")
    .withCapture({ mode: "AUTO" })
    .withCountry("US")
    .withChannel("CNP")
    .withReference("2030404003")
    .withCurrency("USD")
    .execute();

  console.log(transaction);
Tokenization example
     const config = new ServicesConfig();
  config.appKey = "lalala.... find your own";
  config.serviceUrl = "https://apis.sandbox.globalpay.com/ucp";
  config.applicationId = "lalala... find your own";

  ServicesContainer.configure(config);

  const card = new CreditCardData();
  card.number = "4111111111111111";
  card.expiryMonth = "04";
  card.expiryYear = "25";

  const paymentMethod = (await card
    .tokenize()
    .withRequestMultiUseToken(true)
    .withAccountName("Tokenization")
    .withReference("2030404003")
    .execute()) as PaymentMethod;

  paymentMethod.delete().then((detail) => {
    console.log(detail);
  });

About

License:GNU General Public License v2.0


Languages

Language:TypeScript 98.5%Language:JavaScript 1.5%