AFCardKey SDK

Getting Started

You can view a live example on how to use this library here: AFCardKey SDK Live Example

Steps to use AFCardKeySDK

1. Scripts:
Include the following script within your web page code.
                    
                            <type="text/JavaScript" src="//secure.ftipgw.com/admin/js/AFCardKeySDK.js"></script>
                        
                    
2. Initialize SDK:
Use the following code to initialize the AFCardKey library.
                    
                            <type="text/javascript" >
                                $(document).ready(function () {
                                    if (typeof AFCardKeySDK !='undefined' ) {
                                        AFCardKeySDK.init();
                                    }
                                    window.AFCardKeySDK.setTestMode(false);
                                });
                            </script>
                        
                    
Please Note: If you don't want to send request to ArgoFire server, call setTestMode(true) method. With this, dummy responses will be returned.

3. Response Format:
This SDK returns the same response object for all requests. Take note of the code returned, if it is 200 or 201 the request was successful, otherwise it is an error.
                    
                    {
                        statuscode: 0, // 200 is success request, any other is error request.
                        status:"",
                        responseObject: {
                            code: 'OK', //"OK" is for Success request, any other is for error request.
                            ... // And rest of full response of the ArgoFire Api in JSON format.
                        }
                    }
                        
                    

Please Note: responseObject.code will describe the result of the request sent to ArgoFire API. If value is 'OK', then the request is successful.

4. Create Client Session Id Request:
This request should originate from the Integrator's Server Side. The request includes Merchant assigned "Username", "Password" and "Vendor" for the ArgoFire Gateway. When this request is sent to ArgoFire API, the ArgoFire server validates the request and generates a ClientSessionID and returns the ClientSessionID in the response to the client’s server. The ClientSessionID is valid for a configured time after it is generated/received.

To view our API page for the GetClientSessionID operation click here.

5. GetToken:
To tokenize a credit card, the client browser must first send a GetToken request to ArgoFire, then the ArgoFire API will return the tokenized card as a CcInfoKey. If a CcInfoKey was already created, skip this step and move on to step 6. As mentioned, the GetToken operation should be requested from the Client Browser. The request includes a "ClientSessionID", "Account Number", "ExpDate", "Name on card", "Street", "Zip", "First Name" and "Last Name". The ClientSessionID is what you received for the GetClientSessionID request. When this request is sent to the ArgoFire API, the ArgoFire server validates the request, generates a token/CcInfoKey and returns the token/CcInfoKey in the response to the browser.

Request Object:
                    
                            let creditCardObj = {
                                ClientSessionID: '',
                                CcAccountNum: '',
                                CcExpDate: '',
                                CcNameOnCard: '',
                                CcStreet: '',
                                CcZip: '',
                                FirstName: '',
                                LastName: ''
                            };
                        
                    
Javascript SDK method:
                    
                            AFCardKeySDK.GetToken(creditCardObj).then((response) => {
                                if (response.statuscode == 200) {
                                    if (response.responseObject.code == 'OK') {
                                        token.value = response.responseObject.CcInfoKey;
                                    } else {
                                        //error
                                    }
                                } else {
                                    //error
                                }
                            });
                        
                    
Response Object:
                    
                    {
                        statuscode: 200,
                        status: "success",
                        responseObject: {
                            ClientSessionID: "01889d94-308a-4ad5-bc80-2061520b7e83",
                            CcInfoKey: "618679",
                            code: "OK",
                            error: "CCInfoKey generated successfully",
                            Partner: "100",
                            Username: "User1",
                            CustomerID: "19-Test",
                            CustomerKey: "3293"
                        }
                    }
                    
                    

6. Make Payment:
ProcessCreditCard request must be sent by the Integrator's Server.

After CcInfoKey/Token is received, the Integrator's Server will have to send a ProcessCreditCard request to the ArgoFireAPI. ArgoFire validates the request, processes the request with respective payment processors, and returns back the response.

For more details on ProcessCreditCard request click here.