Secure Payments API Import Uploading a File

General

Importing data using a file is one of the import functions of the Secure Payments (formerly PCI Wallet) API.

Uploading a file

There are two types of import files that can be uploaded:

  1. Credit card
  2. Checking account

Both use different endpoints, but are very similar in how they work.

To import a credit card file:

curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'secret: your-secret' --header 'authorization: your-token' 'https://pciwallet.simnang.com/api/credit-card/validate'

Note the content-type must be set to multipart/form-data and the name of the input element must be set to file. For example:

------WebKitFormBoundary4TmI5oJJkkNG2s43
Content-Disposition: form-data; name="file"; filename="cc.csv"
Content-Type: text/csv


------WebKitFormBoundary4TmI5oJJkkNG2s43--

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:

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

The same steps are valid for checking accounts, but the endpoint changes to https://pciwallet.simnang.com/api/checking-account/validate


How did we do?


Powered by HelpDocs (opens in a new tab)