Skip to content

Overview

Batch upload is a service which allows you to upload a CSV (comma seperated values) file containing transactions to be processed. Each file is validated and queued for processing behind the scenes. Once completed, a batch can be download in CSV format containing the response of the transactions processed.

Request Format

Each file should meet the following requirements:

  • First row should be a header using the fields below, fields can be in any order and not all fields are required.
  • Each field should be wrapped in quotes and should not contain any quotes
  • Each field should be seperated with a comma
  • Each row should be terminated with a newline \n character.

Example:

"transaction_type","amount","cc_number","cc_expiration"
"sale","100","4111111111111111","12/25"

Valid fields

Field NameRequiredDescription
transaction_typeYesOne of the following: sale/authorize/credit
cc_numberYes - if credit cardCC Number
cc_expirationYes - if credit cardCC Expiration Date
cc_cvcNoOptional unless your account requires CVC for processing
ach_account_numberYes - if ACHACH account number
ach_routing_numberYes - if ACHACH routing number
ach_account_typeYes - if ACH"checking" or "savings"
ach_sec_codeYes - if ACHSEC code: WEB/CCD/PPD
customer_idYes if using customer vaultcustomer vault id to charge
payment_method_typeNocard/ach if you will specificying a payment_method_id
payment_method_idNoThe specific payment method on the referenced customer you are looking to charge.
amountYesAmount to process as integer. For example $1.00 should be 100
base_amountNoCan be used instead of amount, but will have surcharge and tax added before processing
surchargeNoThe amount to use for surcharge, this is included to amount. For example $1.00 should be 100
shipping_amountNoInteger, should be included in Amount. For example $1.00 should be 100.
tax_amountNoInteger, should be included in Amount. For example $1.00 should be 100.
discount_amountNoInteger, should be included in Amount. For example $1.00 should be 100.
surcharge_exemptNo"true" or "false" if you want to exempt this transaction from having a surcharge applied
order_idNo17 Alphanumeric characters for reference
descriptionNo100 Alphanumeric characters
po_numberNo17 Alphanumeric characters for reference
tax_exemptNo"true" or "false" default "false
email_addressNoEmail address to tag to the transaction, emails are not sent.
email_receiptNo"true" or "false" to send an email receipt
processor_idNoProcessor ID to process the transaction, otherwise the default is used.
billing_first_nameNo
billing_last_nameNo
billing_companyNo
billing_address_line_1No
billing_address_line_2No
billing_cityNo
billing_stateNo
billing_postal_codeNo
billing_countryNo
billing_phoneNo
billing_faxNo
billing_emailNo
shipping_first_nameNo
shipping_last_nameNo
shipping_companyNo
shipping_address_line_1No
shipping_address_line_2No
shipping_cityNo
shipping_stateNo
shipping_postal_codeNo
shipping_countryNo
shipping_phoneNo
shipping_faxNo
shipping_emailNo

Response Format

Example:

"id","user_name","idempotency_key","type","transaction_source","ip_address","amount","amount_authorized","amount_captured","amount_settled","tip","service_fee","tax_amount","tax_exempt","shipping_amount","po_number","order_id","settlement_batch_id","referenced_transaction_id","payment_method","payment_type","response","response_code","status","processor_type","processor_id","processor_name","subscription_id","currency_iso_code","customer_id","email_address","billing_first_name","billing_last_name","billing_company","billing_address_line_1","billing_address_line_2","billing_city","billing_state","billing_postal_code","billing_country","billing_email","billing_phone","billing_fax","shipping_first_name","shipping_last_name","shipping_company","shipping_address_line_1","shipping_address_line_2","shipping_city","shipping_state","shipping_postal_code","shipping_country","shipping_email","shipping_phone","shipping_fax","created_at","captured_at","settled_at","card_type","entry_type","masked_account","expiration","auth_code","processor_response_code","processor_response_text","sec_code","account_type","avs_response_code","cvv_response_code"

API Endpoints

Upload a file

bash
curl -v \
-H "Authorization: APIKEY" \
-F "file=@<FILENAME>" \
  "https://sandbox.pepperpaygateway.com/api/filebatch"
json
{
  "status": "success",
  "msg": "success",
  "data": {
    "id": "bj1o70m9ku6fr2s21fig",
    "file_name": "testfile.csv",
    "status": "pending",
    "num_lines": 1,
    "created_at": "2019-04-26T22:17:38.078185288Z",
    "updated_at": "2019-04-26T22:17:38.078185288Z"
  }
}

Batch status

bash
curl -v \
-H "Authorization: APIKEY" \
-H "Content-Type: application/json" \
  "https://sandbox.pepperpaygateway.com/api/filebatch/<batch id>"

The above command returns JSON structured like this:

json
{
	"id": "bj1o70m9ku6fr2s21fig",
	"user_id": "bj1o70m9ku6fr2s21fig",
	"file_name": "testfile.csv",
	"status": "pending", // 'unknown', 'pending', 'queued', 'processing', 'failed' or 'completed'
	"num_lines": 1,
	"processed_lines": 1,
	"created_at": "2019-04-26T22:17:38.078185288Z",
	"updated_at": "2019-04-26T22:17:38.078185288Z"
}

Download

TIP

Only batches that are in completed status can be downloaded. After 10 days, batch results will no longer be available.

bash
curl -v \
-H "Authorization: APIKEY" \
-H "Content-Type: application/json" \
  "https://sandbox.pepperpaygateway.com/api/filebatch/<batch id>/download"

This will stream the batch results if successful. Otherwise an error will be returned like so:

json
{
  "status":"failed",
  "msg":"batch is not in completed status",
  "data":null
}