1.0.19 • Published 6 months ago

procharge-react v1.0.19

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

version npm version react angular typescript

Procharge ReactJS API

If you are interested in processing payments with Electronic Payments click here Merchant Signup to start the process.

Use this TypeScript library to process sales, authorizations, ticket captures, voids, refunds and balance inquiries and EPI Gift Card processing with Procharge.

Requirements

  • ES2018, ES2020, ES2022, ES2023, ESNext compatible client is supported
  • Angular >= 14

Running npm command requires NodeJS to be installed. Use the following links to download.

Using yarn installer click the following link for installation

This API supports ReactJS versions that are either current, or that are in long-term support status (LTS). The library does not support ReactJS versions that have reached their end-of-life (EOL).

While this package is targeting ReactJS, Angular client is supported as well. This API is for use with esnext compatible clients.

Note: In order to use this package within an Angular project the below npm install may be necessary.

npm install @typescript/lib-dom@npm:@types/web --save-dev --force

Installation

Open a command line and change directory to the location of your package.json file.

Using npm

npm i procharge-react

Using yarn

yarn add procharge-react

Usage

The package needs to be configured with your account's application key and user login credentials, which is available in the Procharge Gateway.

Additional documentation can be found here Procharge API Documentation which contains examples and schema information under the Card Transactions section.

All the below examples are using an invalid merchant number and credit card and are for documentation purposes only so be sure to enter valid information when invoking the client.

Within the Procharge API Documentation there is a list of mock card numbers you can use for sandbox testing.

import { Client, Environment, AuthResponse, Transaction, TransactionResponse } from "procharge-react";

API Reference

Methods

Gift Cards

Request Access Token

Use the same credentials that you use when logging into the Procharge Gateway portal. Copy the access_token returned in the response to the call to getAccessToken and pass in the client authToken parameter.

let client = new Client({ .... authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." });

For development use the below application key in all calls:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk
import { Client, Environment, AuthResponse } from "procharge-react";
                
let client = new Client({
    env: Environment.Development
});

let response: AuthResponse = await client.getAccessToken({
  "userName": "johndoe",
  "passWord": "Test1234",
  "pin": "12345678",
  "application": "procharge"
}).catch((error: any) => {
    console.log(error);
    reject(error);
}) as AuthResponse;

if(!response) {
    return;
} else {
    console.log("access_token: " + response.access_token);
    console.log("refresh_token: " + response.refresh_token);
    return resolve(response)
}  

Request Access Token Response

{
    "access_token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRGllZ28gR2lsIiwidXNlcm5hbWUiOiJqb2huZG9lIiwicm9sZXMiOlsidXNlcnMiLCJwcm9jaGFyZ2UiXSwidXNlciI6eyJhY2Nlc3NfdG9rZW4iOiIiLCJyZWZyZXNoX3Rva2VuIjoiIiwiYnVzaW5lc3NOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiZmlyc3ROYW1lIjoiRGllZ28iLCJsYXN0TmFtZSI6IkdpbCIsImdyb3VwcyI6WyJ1c2VycyIsInByb2NoYXJnZSJdLCJlbWFpbCI6ImRpZWdvQGVsZWN0cm9uaWNwYXltZW50cy5jb20iLCJtZXJjaGFudE51bWJlciI6Ijg4OTkwMTU1MDU5NDcwMiIsInBheW1lbnRHYXRld2F5SUQiOiI1IiwibWVyY2hhbnRJRCI6MTM2NDQ3NzYsInByb2ZpbGVJRCI6MTcxNDk4MDYsInByb2ZpbGVOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiYWNxdWlyZXJJRCI6IjQxMTc2MyIsInRlcm1pbmFsSUQiOiJQUk9DSEcwMiIsImNyZWF0ZWREYXRlIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwibGFzdExvZ2luIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwiaW5kdXN0cnlUeXBlIjo2fSwiaXNSZWZyZXNoVG9rZW4iOmZhbHNlLCJpYXQiOjE3MzIwMTk2MDMsImV4cCI6MTczMjA3NzIwM30.pR2LI9PkvDmizHSTNnRvjwz3IGv_45l6p0To3Z2EnVw",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRGllZ28gR2lsIiwidXNlcm5hbWUiOiJqb2huZG9lIiwicm9sZXMiOlsidXNlcnMiLCJwcm9jaGFyZ2UiXSwidXNlciI6eyJhY2Nlc3NfdG9rZW4iOiIiLCJyZWZyZXNoX3Rva2VuIjoiIiwiYnVzaW5lc3NOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiZmlyc3ROYW1lIjoiRGllZ28iLCJsYXN0TmFtZSI6IkdpbCIsImdyb3VwcyI6WyJ1c2VycyIsInByb2NoYXJnZSJdLCJlbWFpbCI6ImRpZWdvQGVsZWN0cm9uaWNwYXltZW50cy5jb20iLCJtZXJjaGFudE51bWJlciI6Ijg4OTkwMTU1MDU5NDcwMiIsInBheW1lbnRHYXRld2F5SUQiOiI1IiwibWVyY2hhbnRJRCI6MTM2NDQ3NzYsInByb2ZpbGVJRCI6MTcxNDk4MDYsInByb2ZpbGVOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiYWNxdWlyZXJJRCI6IjQxMTc2MyIsInRlcm1pbmFsSUQiOiJQUk9DSEcwMiIsImNyZWF0ZWREYXRlIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwibGFzdExvZ2luIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwiaW5kdXN0cnlUeXBlIjo2fSwiaXNSZWZyZXNoVG9rZW4iOnRydWUsImlhdCI6MTczMjAxOTYwMywiZXhwIjoxNzMyNjI0NDAzfQ.dD3-SXCX2qV6LrVnizo95VtcYzVpMMGLSrk1hbmirgU",
    "lastLogin": "2024-11-19T12:33:23.839Z"
}

Refresh Token

Pass refreshToken from previous call to getAccessToken to retrieve a new access_token and refresh_token.

import { Client, Environment, AuthResponse } from "procharge-react";
                
let client = new Client({
    env: Environment.Development
});

let response: AuthResponse = await client.getRefreshToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9......").catch((error: any) => {
    console.log(error);
    reject(error);
}) as AuthResponse;

if(!response) {
    return;
} else {
    console.log("access_token: " + response.access_token);
    console.log("refresh_token: " + response.refresh_token);
    return resolve(response)
}  

Refresh Token Response

{
    "access_token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRGllZ28gR2lsIiwidXNlcm5hbWUiOiJqb2huZG9lIiwicm9sZXMiOlsidXNlcnMiLCJwcm9jaGFyZ2UiXSwidXNlciI6eyJhY2Nlc3NfdG9rZW4iOiIiLCJyZWZyZXNoX3Rva2VuIjoiIiwiYnVzaW5lc3NOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiZmlyc3ROYW1lIjoiRGllZ28iLCJsYXN0TmFtZSI6IkdpbCIsImdyb3VwcyI6WyJ1c2VycyIsInByb2NoYXJnZSJdLCJlbWFpbCI6ImRpZWdvQGVsZWN0cm9uaWNwYXltZW50cy5jb20iLCJtZXJjaGFudE51bWJlciI6Ijg4OTkwMTU1MDU5NDcwMiIsInBheW1lbnRHYXRld2F5SUQiOiI1IiwibWVyY2hhbnRJRCI6MTM2NDQ3NzYsInByb2ZpbGVJRCI6MTcxNDk4MDYsInByb2ZpbGVOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiYWNxdWlyZXJJRCI6IjQxMTc2MyIsInRlcm1pbmFsSUQiOiJQUk9DSEcwMiIsImNyZWF0ZWREYXRlIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwibGFzdExvZ2luIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwiaW5kdXN0cnlUeXBlIjo2fSwiaXNSZWZyZXNoVG9rZW4iOmZhbHNlLCJpYXQiOjE3MzIwMTk2MDMsImV4cCI6MTczMjA3NzIwM30.pR2LI9PkvDmizHSTNnRvjwz3IGv_45l6p0To3Z2EnVw",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiRGllZ28gR2lsIiwidXNlcm5hbWUiOiJqb2huZG9lIiwicm9sZXMiOlsidXNlcnMiLCJwcm9jaGFyZ2UiXSwidXNlciI6eyJhY2Nlc3NfdG9rZW4iOiIiLCJyZWZyZXNoX3Rva2VuIjoiIiwiYnVzaW5lc3NOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiZmlyc3ROYW1lIjoiRGllZ28iLCJsYXN0TmFtZSI6IkdpbCIsImdyb3VwcyI6WyJ1c2VycyIsInByb2NoYXJnZSJdLCJlbWFpbCI6ImRpZWdvQGVsZWN0cm9uaWNwYXltZW50cy5jb20iLCJtZXJjaGFudE51bWJlciI6Ijg4OTkwMTU1MDU5NDcwMiIsInBheW1lbnRHYXRld2F5SUQiOiI1IiwibWVyY2hhbnRJRCI6MTM2NDQ3NzYsInByb2ZpbGVJRCI6MTcxNDk4MDYsInByb2ZpbGVOYW1lIjoiQ3lnbWEgQnJhbmRjZXJ0IiwiYWNxdWlyZXJJRCI6IjQxMTc2MyIsInRlcm1pbmFsSUQiOiJQUk9DSEcwMiIsImNyZWF0ZWREYXRlIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwibGFzdExvZ2luIjoiMjAyNC0xMS0xOVQxMjozMzoyMy44MzlaIiwiaW5kdXN0cnlUeXBlIjo2fSwiaXNSZWZyZXNoVG9rZW4iOnRydWUsImlhdCI6MTczMjAxOTYwMywiZXhwIjoxNzMyNjI0NDAzfQ.dD3-SXCX2qV6LrVnizo95VtcYzVpMMGLSrk1hbmirgU",
    "lastLogin": "2024-11-19T12:33:23.839Z"
}

Sale

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";
              
let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.amount = "0.05";
transaction.taxAmount = "0.01";
transaction.tipAmount = "0.00";
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.cardNumber = "5204730000001003";
transaction.ccExpMonth = "12";
transaction.ccExpYear = "25";
transaction.cvv = "100";    // <-- Only set if performing cvv verification
transaction.aci = "Y";      // <-- Only set if performing avs verification
transaction.name = "John Doe";
transaction.street1 = "7305 test street";
transaction.street2 = "";
transaction.city = "Omaha";
transaction.state = "NE";
transaction.postalCode = "68114";
transaction.email = "jdoe@widget.com";
transaction.companyName = "Joes Moving Company";
transaction.orderNumber = "123456";

let response: TransactionResponse = await client.processSale(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Void Sale

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});
                
let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.transactionID = "429811000636";
transaction.approvalCode = "097502";

let response: TransactionResponse = await client.voidSale(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Auth Only

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});
                
let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.amount = "0.05";
transaction.cardNumber = "5204730000001003";
transaction.ccExpMonth = "12";
transaction.ccExpYear = "25";
transaction.cvv = "100";    // <-- Only set if performing cvv verification
transaction.aci = "Y";      // <-- Only set if performing avs verification
transaction.name = "John Doe";
transaction.street1 = "7305 test street";
transaction.street2 = "";
transaction.city = "Omaha";
transaction.state = "NE";
transaction.postalCode = "68114";
transaction.email = "jdoe@widget.com";
transaction.companyName = "Joes Moving Company";
transaction.orderNumber = "123456";

let response: TransactionResponse = await client.authorizeOnly(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Void Auth Only

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});
               
let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.transactionID = "429811000636";
transaction.approvalCode = "097502";
transaction.invoiceID = 447803694;
transaction.paymentID = 447857739;
transaction.cardNotPresent = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 

let response: TransactionResponse = await client.voidAuthOnly(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Ticket Completion

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});
        
let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.transactionID = "429811000636";    
transaction.approvalCode = "097502";
transaction.invoiceID = 447803694;
transaction.paymentID = 447857739;
transaction.cardNotPresent = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.amount = "0.05";
transaction.taxAmount = "0.01";

let response: TransactionResponse = await client.completeTicket(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Void Ticket

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.transactionID = "429811000636";
transaction.approvalCode = "097502";
transaction.cardNotPresent = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 

let response: TransactionResponse = await client.voidTicketOnly(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}        

Refund

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.amount = "0.05";
transaction.taxAmount = "0.01";
transaction.tipAmount = "0.00";
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.cardNumber = "4***********0492";
transaction.ccExpMonth = "12";
transaction.ccExpYear = "25";
transaction.cvv = "100";                // <-- Only set if performing cvv verification
transaction.aci = "N";                  // <-- No avs verification on refunds

let response: TransactionResponse = await client.processRefund(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Void Refund

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.transactionID = "429811000636";
transaction.approvalCode = "097502";
transaction.cardNotPresent = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 

let response: TransactionResponse = await client.voidRefund(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}        

PrePaid Balance Inquiry

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.cardNumber = "5204730000001003";
transaction.ccExpMonth = "12";
transaction.ccExpYear = "30";
transaction.cvv = "100";
transaction.amount = "0.00";
transaction.taxAmount = "0.00";
transaction.aci = "N";
transaction.isPurchaseCard = true;
transaction.cardNotPresent = true;
transaction.cardTypeIndicator = "P";    // C - Credit, D - Debit, P - Debit PrePaid 

let response: TransactionResponse = await client.prePaidBalanceInquiry(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Validate Card

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isEcommerce = true;
transaction.amount = "0.00";        // <-- Leave 0.00 amount for validation
transaction.taxAmount = "0.00";     // <-- Leave 0.00 amount for validation
transaction.tipAmount = "0.00";
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.aci = "Y";                  // <-- Only set if performing avs verification
transaction.name = "John Doe";
transaction.street1 = "7305 test street";
transaction.postalCode = "68114";

let response: TransactionResponse = await client.validateCard(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

EMV

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isRetail = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.emv = "5F2A020840820258008407A0000000031010950502800080009A031806259C01009F02060000000020009F03060000000000009F0902008C9F100706011203A000009F1A0208409F1E0832343437383135335F24032212319F2608B4E599A67DD0828E9F2701809F3303E0F8C89F34031E03009F3501229F360200029F3704B71461199F4104000006755F340101";
transaction.aci = "N";

let response: TransactionResponse = await client.processSale(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Swiped Sale

import { Client, Environment, Transaction, TransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: Transaction = new Transaction();
transaction.isRetail = true;
transaction.cardTypeIndicator = "C";    // C - Credit, D - Debit, P - Debit PrePaid 
transaction.trackData = "5204730000001003D24122010000000000000";
transaction.aci = "N";

let response: TransactionResponse = await client.processSale(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as TransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Gift Cards

entryMode values

ValueDescription
-1OMITTED
0OTHER
1MAGNETIC
2MANUAL
3BARCODE
4CONTACTLESS
5EMV

industryType values

ValueDescription
0INACTIVE
1RETAIL
2RESTAURANT
3HOTEL
4FUEL
10HOUSE ACCOUNT

Swiped Versus Manual Entry

Swiped entries use the track2 property

transaction.track2 = "6265555707036313=0000"

Manual entries use the cardNo property

transaction.cardNo = "6265555707036313"


Gift Card Activation

import { Client, Environment, GiftCardTransaction, GiftCardTransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: GiftCardTransaction = new GiftCardTransaction();
transaction.track2 = "6265555707036313=0000";
transaction.entryMode = "1";
transaction.industryType = "1"; 

let response: GiftCardTransactionResponse = await client.activateGiftCard(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as GiftCardTransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Redeem Gift Card

import { Client, Environment, GiftCardTransaction, GiftCardTransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: GiftCardTransaction = new GiftCardTransaction();
transaction.track2 = "6265555707036313=0000";
transaction.entryMode = "1";
transaction.industryType = "1";
transaction.amount = 0.05;

let response: GiftCardTransactionResponse = await client.redeemGiftCard(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as GiftCardTransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Gift Card Balance Transfer

import { Client, Environment, GiftCardTransaction, GiftCardTransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: GiftCardTransaction = new GiftCardTransaction();
transaction.fromCardNo = "6265555707036313";
transaction.cardNo = "6609603310096204";
transaction.entryMode = "2";
transaction.industryType = "1";
transaction.amount = 5.00;

let response: GiftCardTransactionResponse = await client.transferGiftCardBalance(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as GiftCardTransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Gift Card Balance Inquiry

import { Client, Environment, GiftCardTransaction, GiftCardTransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: GiftCardTransaction = new GiftCardTransaction();
transaction.track2 = "6265555707036313=0000";
transaction.entryMode = "1";
transaction.industryType = "1";
transaction.amount = 0.00;

let response: GiftCardTransactionResponse = await client.giftCardBalanceInquiry(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as GiftCardTransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Gift Card Void

import { Client, Environment, GiftCardTransaction, GiftCardTransactionResponse } from "procharge-react";

let client = new Client({
    env: Environment.Development,
    applicationKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk",
    authToken: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
});

let transaction: GiftCardTransaction = new GiftCardTransaction();
transaction.entryMode = "2";
transaction.industryType = "1";
transaction.amount = 1.00;
transaction.transactionID = "255410";

let response: GiftCardTransactionResponse = await client.voidGiftCardSale(transaction).catch((error: any) => {
    console.log(error);
    reject(error);
}) as GiftCardTransactionResponse;

if(!response) {
    return;
} else {
    return resolve(response)
}

Deprecated APIs

  • procharge-api
1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.16

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.12

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago