ChargeItPro Javascript API Documentation
To get started using EasyIntegrator.
Our ChargeItProWebDriver allows your Web Site to communicate with Hardware Devices to capture payment information and signatures.
Include the following scripts on your page:
<script src="https://az415749.vo.msecnd.net/webpos/jquery-1.9.1.js"></script>
<script src="https://az415749.vo.msecnd.net/webpos/EasyIntegrator-1.0.0.js"></script>
To test connectivity to the Charge It Pro server, you can 'echo' a message.
var request = { "message" : "Echo Test" }; EasyIntegrator.echo(request) .success(function(){ alert(EasyIntegrator.response.message); }) .error(function(){ alert(EasyIntegrator.errorMessage); });
Before you Process a Transaction, you must configure the workstation. This is how you Setup (configure) a workstation.
$("#Setup").on("click", function () { var request = { "merchantName": "TestUser1", "merchantKey": "842e1b378d0d41be97d05bfa9b014ee9" }; EasyIntegrator.runSetup(request) .success(function(configurationId){ var configurationId = configurationId; //IMPORTANT: You must store this configurationId //(ie in a database) and pass it in on all Transaction Requests. }) .error(function(errorMessage){ alert(errorMessage); });Back to Top
All transactions must specify a Transaction Type. Available Transaction Types are: ACHReturn, ACHSale, AddCheckPayment, AddCreditPayment, CloseBatch, CreateCustomer, CreditAddTip, CreditAuth, CreditForce, CreditReturn, CreditSale, CreditSaveCard, DebitReturn, DebitSale, DeleteCustomer, DeletePayment, GenericVoid, GiftAddValue, GiftBalance, GiftRedeem, GiftRedeemMax, ModifyExpirationDate, RequestSignature, RunSetup, SchedulePayments, UpdateCustomer and UpdatePayment.
The TransFields Object may contain the following: AccountData, AccountExpirationDate, ACHFormat, AmountFee, AmountTip AmountTotal, ApprovalNumber, BillingStreetAddress, BillingZip, CashBack, Cashier, CVVNumber, Level2CustomerCode, Level2OrderNumber, Level2Tax, PinpadBlock, PinpadNumber, SMID, TransactionReference and UniqueTransRef.
//Step 1: Get Data from your form. var amount = $("#Amount").val(); //Step 2: Create JSON object to pass to EasyIntegrator. var request = { "merchantName": "TestUser1", "merchantKey": "842e1b378d0d41be97d05bfa9b014ee9", "configurationId": "ea060c2e06144e6398e9523271801d6e", "transactionType": "CreditSale", "transFields": { "amountTotal": amount } }; //Step 3: Pass request JSON object to the EasyIntegrator processTransaction method. EasyIntegrator.processTransaction(request) .success(function(resultsFields){ //Do Stuff on a Successful Transaction. var transactionId = resultsFields.UniqueTransId; }) .error(function(errorMessage){ alert(errorMessage); }) .done(function() { //Execute code after the success or error events have fired });Back to Top
The ResultsField Object contains the following properties/fields you can use to populate your receipt: AccountCardType, AccountEntryMethod, AccountExpiryDate, AccountHash, AmountBalance, AmountBill, AmountFee, AmountProcessed, ApprovalNumberResult, AvsResponseCode, AvsResponseText, BatchNumber, BillingName, CvvResponseCode, CvvResponseText, MaskedAccount, ResultMessage, ResultStatus, SignatureURL, TransactionType and UniqueTransId.
Back to TopEasyIntegrator returns a Signature URL that you can use to set the 'src' attribute of an HTML img tag.
$("#Signature").attr("src", EasyIntegrator.resultsFields.SignatureURL);
<img id="Signature" src="http://easyintegratorapi.chargeitpro.com/signature.ashx?ID=5176a7b89ee750098c9bdef5f" alt=""/>
EasyIntegrator allows you to charge a return Customer without a Credit Card via a process called Tokenization. You must intercept and store the EasyIntegrator.resultsFields.UniqueTransId returned on a successful transaction, then pass this in via the EasyIntegrator.transFields.UniqueTransReffield on subsequent transactions.
//Step 1: Process a transaction and save the returned uniqueTransId. EasyIntegrator.processTransaction(request) .success(function (resultsFields) { //Capture and save the uniqueTransId var transactionId = resultsFields.UniqueTransId; }); //Step 2: Include this id in the JSON object's transFields uniqueTransRef //field before you pass it in to the processTransaction method. var request = { "merchantName": "...", "merchantKey": "...", "configurationId": "...", "transactionType": "CreditSale", "transFields": { "amountTotal": amount, "uniqueTransRef": "3dda302f811844bc8984c90d37b0167b" } };
To Create a Customer, you must specify the transactionType as 'CreateCustomer' and pass in a customerFields JSON object.
The CustomerFields Object may contain the following: Address, Address2, City, Company, Country, CustomerID, Email, FirstName LastName, Phone, ScheduledPayments, State and Zip.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "CreateCustomer",
"customerFields": {
"firstName": "Test",
"lastName": "User",
"address": "1 Mockingbird Ln.",
"address2" : "",
"city": "Boise",
"state": "ID",
"zip": "83704"
"company": "Customer's Company",
"email": "email@domain.com",
"phone": "555-555-5555
}
};
EasyIntegrator.processTransaction(request)
.success(function (customer) {
var customerRef = customer.customerRef;
});
To Update a Customer, you must specify the transactionType as 'UpdateCustomer' and pass in a customerFields JSON object that contains the customerRef identifier generated by the CreateCustomer transaction.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "UpdateCustomer",
"customerFields": {
"customerRef": 200001,
"firstName": "UpdatedTest",
"lastName": "UpdatedUser",
"address": "2 Mockingbird Ln.",
"address2" : "",
"city": "Boise",
"state": "ID",
"zip": "83704"
"company": "Customer's Company",
"email": "email@domain.com",
"phone": "555-555-5555
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Customer has been updated.')
});
To Delete a Customer, you must specify the transactionType as 'DeleteCustomer' and pass in a customerFields JSON object that contains the customerRef identifier generated by the CreateCustomer transaction.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "DeleteCustomer",
"customerFields": {
"customerRef": 200001,
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Customer has been deleted.')
});
To Add a Check Payment for a Customer, you must specify the transactionType as 'AddCheckPayment' and pass in a customerFields JSON object that contains the customerRef identifier generated by the CreateCustomer transaction.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "AddCheckPayment",
"customerFields": {
"customerRef": 200001,
}
};
EasyIntegrator.processTransaction(request)
.success(function (customer) {
var paymentId = customer.paymentId;
});
To Add a Credit Payment for a Customer, you must specify the transactionType as 'AddCreditPayment' and pass in a customerFields JSON object that contains the customerRef identifier generated by the CreateCustomer transaction.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "AddCreditPayment",
"customerFields": {
"customerRef": 200001,
}
};
EasyIntegrator.processTransaction(request)
.success(function (customer) {
var paymentId = customer.paymentId;
});
To Modify an Expiration Date for an existing Credit Payment, you must specify the transactionType as 'UpdateExpirationDate' and pass in a customerFields JSON object that contains the customerRef identifier and paymentId generated by the AddCreditPayment transaction.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "UpdateExpirationDate",
"customerFields": {
"customerRef": 200001,
"paymentId": 3010101
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Expiration Date has been successfully updated.');
});
To Schedule Payments for a Customer, you must specify the transactionType as 'SchedulePayments' and pass in a customerFields JSON object that contains the customerRef identifier.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "SchedulePayments",
"customerFields": {
"customerRef": 200001
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Payments have been successfully scheduled.');
});
To Update an Existing Payment, you must specify the transactionType as 'UpdatePayment'
and pass in a customerFields JSON object that contains the customerRef identifier.
Note:This Transaction also updates the customer fields.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "UpdatePayment",
"customerFields": {
"customerRef": 200001,
"firstName": "Test",
"lastName": "User",
"address": "2 Mockingbird Ln.",
"address2" : "",
"city": "Boise",
"state": "ID",
"zip": "83704"
"company": "Customer's Company",
"email": "email@domain.com",
"phone": "555-555-5555
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Payment has been successfully updated.');
});
To Delete Payment, you must specify the transactionType as 'DeletePayment'
and pass in a customerFields JSON object that contains the customerRef identifier.
Note:This Transaction also updates the customer fields.
var request = {
"merchantName": "...",
"merchantKey": "...",
"configurationId": "...",
"transactionType": "DeletePayment",
"customerFields": {
"customerRef": 200001,
"paymentId": 3010101
}
};
EasyIntegrator.processTransaction(request)
.success(function () {
alert('Payment has been successfully updated.');
});
Include the following scripts on your page:
<script src="https://az415749.vo.msecnd.net/webpos/jquery-1.9.1.js"></script>
<script src="https://az415749.vo.msecnd.net/webpos/EasyIntegratorWeb-1.0.0.js"></script>//For testing
<script src="https://az415749.vo.msecnd.net/webpos/EasyIntegratorWeb.debug.js"></script>
//Step 1: Get Data from your form. var amount = $("#Amount").val(); //Step 2: Create JSON object to pass to EasyIntegrator. var request = { "merchantName": "TestUser1", "merchantKey": "842e1b378d0d41be97d05bfa9b014ee9", "configurationId":"ea060c2e06144e6398e9523271801d6e", "transactionType": "sale", "invoiceId":"123ABC456DEF", "amount": amount }; //Step 3: Pass request JSON object to the EasyIntegratorWeb processTransaction method. EasyIntegratorWeb.processTransaction(request) .success(function(response){ //Do Stuff on a Successful Transaction. var transactionId = response.Result.TransactionId; var refNum = response.Result.RefNum; }) .error(function(errorMessage){ alert(errorMessage); }) .done(function() { //Execute code after the success or error events have fired });
Having trouble? Contact support and we’ll help you sort it out.