Skip to content

NMI Direct Post API software making payment processing easy with JavaScript.

License

Notifications You must be signed in to change notification settings

dreamingrainbow/NMI-DirectPay-GWAPI

Repository files navigation

NMI-DirectPay-GWAPI

Setup

npm i https://github.com/dreamingrainbow/NMI-DirectPay-GWAPI

Usage:

Initialize the GWAPI Instance with a callback.

const gw = new gwapi((responses) => {
  const _responses = {};
  responses.split('&').forEach(response => {
    const r = response.split("=");
    _responses[r[0]] = r[1];
  })
  console.log(_responses);
});

Set the merchant secure token

gw.setLogin("6457Thfj624V5r7WUwc5v6a68Zsd6YEm");

Set the client billing information

gw.setBilling(
  "John",
  "Smith",
  "Acme, Inc.",
  "123 Main St",
  "Suite 200",
  "Beverly Hills",
  "CA",
  "90210",
  "US",
  "555-555-5555",
  "555-555-5556",
  "[email protected]",
  "www.example.com"
);

Set the client shipping information

gw.setShipping(
  "Mary",
  "Smith",
  "na",
  "124 Shipping Main St",
  "Suite Ship",
  "Beverly Hills",
  "CA",
  "90210",
  "US",
  "[email protected]"
);

Set the order details.

gw.setOrder("1234", "Big Order", 1, 2, "PO1234", "65.192.14.10");

Set the Transaction Payment Method for credit card payments.

gw.setPaymentMethod({
  payment: "creditcard",
  ccnumber : "4111111111111111",
  ccexp : "1010",
  cvv : "",
});
    

Set the Transaction Payment Method for check payments.

gw.setPaymentMethod({
  payment: "check",
  checkname: "Example User",
  checkaba: 123123123,
  checkaccount: 123123123,
  account_holder_type: "personal",
  account_type: "checking",
}); 

Process the sale

gw.doSale({amount:"50.00"});

Using the payment method creditcard the callback should return :

{
  response: '1',
  responsetext: 'SUCCESS',
  authcode: '123456',
  transactionid: '5716156064',
  avsresponse: 'N',
  cvvresponse: '',
  orderid: '',
  type: 'sale',
  response_code: '100',
  cc_number: '4xxxxxxxxxxx1111',
  customer_vault_id: ''
}

Using the payment method check the callback should return :

{
  response: '1',
  responsetext: 'SUCCESS',
  authcode: '123456',
  transactionid: '5716156061',
  avsresponse: '',
  cvvresponse: '',
  orderid: '',
  type: 'sale',
  response_code: '100',
  cc_number: '',
  customer_vault_id: ''
}

About

NMI Direct Post API software making payment processing easy with JavaScript.

Topics

Resources

License

Stars

Watchers

Forks