Secure Payments API – Importing Payment Profile Files
Introduction
Importing data using a file is one of the import functions of the Secure Payments API.
Uploading a file
There are two types of import files that can be uploaded:
- Credit card
- Checking account
Both use different endpoints, but are very similar in how they work.
Importing Credit Card Files
To import a credit card file, send a POST request to the following endpoint:
POST https://securepayments.loanpro.io/api/credit-card/validate
The payload for this request is sent in multipart/form-data format. The content-disposition
must be set to multipart/form-data
and the name of the input element must be set to file
. Here's an example of what the payload should look like:
------WebKitFormBoundary4TmI5oJJkkNG2s43
Content-Disposition: form-data; name="file"; filename="cc.csv"
Content-Type: text/csv
------WebKitFormBoundary4TmI5oJJkkNG2s43--
Here's an example of the request in cURL format:
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'secret: your-secret' --header 'authorization: your-token' 'https://securepayments.loanpro.io/api/credit-card/validate'
When uploaded, each row from the source file is validated. If everything is ok, the response is as follows:
Source:
John doe,012017,4111111111111111,123 Oak Lane,Schenectady,NY,12345,USA
Response:
{
"report": "https://s3.amazonaws.com/easypay-import/cesarVM/output/5/2016-04-01/credit-card-import-1459536466496.csv?AWSAccessKeyId=AKIAJGQGUJA7YYQOD6SQ&Expires=1459537366&Signature=DJTLwACDkXGFh7By%2Fvy8tmMLmNE%3D",
"result": [
{
"id": 1,
"token": "Validation",
"message": "ok"
}
]}
The result
array contains one element per verified row. In this case, our source file contained only one row, so the result
array only contains one element. Each element is assigned an incremental id
based on the row number.
If a row doesn’t validate correctly, then the response will contain the error. Here's an example of what this would look like:
Source:
John doe,012017,4111111111111111,123 Oak Lane,Schenectady,NY,12345,USA
John doe,012017a,3111111111111111,123 Oak Lane,Schenectady,NY,12345,USA
Response:
{
"report": "https://s3.amazonaws.com/easypay-import/cesarVM/output/5/2016-04-01/credit-card-import-1459536887488.csv?AWSAccessKeyId=AKIAJGQGUJA7YYQOD6SQ&Expires=1459537787&Signature=KuqkzIx6fTDkeFyYTreMmWBpZdU%3D",
"result": [
{
"id": 1,
"token": "Validation",
"message": "ok"
},
{
"id": 2,
"token": "Validation",
"message": {
"card_number": [
"Must be a valid credit card number."
],
"expiration_date": [
"Must a valid date formatted as MMYYYY."
]
}
}
]}
The report
URL can be used to download the validation report, in CSV format.:
token,message,id
Validation,ok,1
Validation,"{:card_number #{""Must be a valid credit card number.""}, :expiration_date #{""Must a valid date formatted as MMYYYY.""}}",2
Importing Checking Account Files
The same steps are valid for checking accounts, but the endpoint changes to checking-account
.
POST https://securepayments.loanpro.io/api/checking-account/validate