procharge
v1.0.26
Published
Procharge Payment Processing
Downloads
1,584
Maintainers
Readme
Procharge API For NodeJS
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 with Procharge.
Requirements
Use of the Procharge NodeJS Typescript API requires:
- Node.js 14 or higher
This API supports NodeJS versions that are either current, or that are in long-term support status (LTS). The API does not support NodeJS versions that have reached their end-of-life (EOL). For more information on Node.js versioning, see https://nodejs.org/en/about/releases/.
Installation
npm i procharge
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.
Http2 is supported, for more details and examples click on the following link Client Side Http/2.
import { Client, Environment, Transaction, TransactionResponse } from "procharge";
API Reference
Methods
- Request Access Token
- Refresh Token
- Sale
- Void Sale
- Auth Only
- Void Auth Only
- Ticket Completion
- Void Ticket
- Refund
- Void Refund
- PrePaid Balance Inquiry
- Validate Card
- EMV
- Swiped Sale
Gift Cards
- Gift Card Activation
- Redeem Gift Card
- Gift Card Balance Transfer
- Gift Card Balance Inquiry
- Gift Card Void
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..." });
Use the below application key in all calls:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoiZyIsIm1pZCI6Ijg4OTkwMTU1MDU5NDcwMiIsInRva2VuIjoiIiwicm9sZXMiOlsidXNlciIsIm1lcmNoYW50IiwicHJvY2hhcmdlIl0sInBheWxvYWQiOnsiYXBpS2V5T25seSI6dHJ1ZSwiZGV2ZWxvcG1lbnRPbmx5Ijp0cnVlLCJyb3V0ZU5hbWUiOiJwcm9jaGFyZ2UifSwiaWF0IjoxNzMwNDkyMTY0fQ.PWEaR00Cjc7ld2D9KCol5B4SI1up_9BQSMpCXWoZwhk
import { Client, Environment, AuthResponse } from "procharge";
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);
}
Refresh Token
Pass refreshToken from previous call to getAccessToken to retrieve a new access_token and refresh_token.
import { Client, Environment, AuthResponse } from "procharge";
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)
}
Sale
import { Client, Environment, Transaction, TransactionResponse } from "procharge";
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 = "[email protected]";
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";
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";
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 = "[email protected]";
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";
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";
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";
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";
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 = "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";
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";
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";
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";
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";
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 = "5204730000001003D25122010000000000000";
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
| Value | Description | | ------------- |:-------------| | -1 | OMITTED | | 0 | OTHER | | 1 | MAGNETIC | | 2 | MANUAL | | 3 | BARCODE | | 4 | CONTACTLESS | | 5 | EMV |
industryType values
| Value | Description | | ------------- |:-------------| | 0 | INACTIVE | | 1 | RETAIL | | 2 | RESTAURANT | | 3 | HOTEL | | 4 | FUEL | | 10 | HOUSE 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";
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";
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";
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";
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";
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
- none