Pay By ACH - Existing Customer
This guide walks through creating and capturing a payment by ACH. For this example, we will charge an amount of $12.01 to a customer account we had already created using the Create Customer API. Our customer's ID is DjPnVDNApDDnVpMN
.
Let's assume our customer is John
Hancock
, the owner of a Personal Checking
account with the routing number 129131673
and account number 0114584906
.
Step 1: Create Bank Account
POST
https://api.payarc.net/v1/bankaccounts/{id}
We will use this API to store the bank account information for the customer performing the transaction.
Parameter | Description |
---|---|
account_number Required | Account Number for the account. Format: Numeric, Length 3-17. Example: 0114584906 |
routing_number Required | Nine-digit routing number for the account. Format: Numeric, Length:9 Example: 129131673 |
first_name Required | Account holder's first name Format: AlphaNumeric, Length 2-50 Example: John |
last_name Required | Account holder's first name Format: AlphaNumeric, Length 2-50 Example: Hancock |
account_type Required | The type of account Format: One of the following: Personal Checking , Personal Savings , Business Checking , Business Savings Example: Personal Checking |
customer_id Optional | The Customer ID against which a new subscription will be created via the Create a Customer API Format: AlphaNumeric Example: DjPnVDNApDDnVpMN |
import http.client
conn = http.client.HTTPSConnection("api.payarc.net")
payload = 'account_number=%0114584906%22&routing_number=%129131673%22&first_name=%22John%22&last_name=%22Hancock%22&account_type=%22Personal%20Checking%22&&customer_id=%22DjPnVDNApDDnVpMN%22'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}'
}
conn.request("POST", "/v1/bankaccounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.payarc.net/v1/bankaccounts',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}'
},
form: {
'account_number': '"0114584906"',
'routing_number': '"129131673"',
'first_name': '"John"',
'last_name': '"Hancock"',
'account_type': '"Personal Checking"',
'customer_id': '"DjPnVDNApDDnVpMN"'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.payarc.net/v1/bankaccounts");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{Access-Token-From-Payarc-Dashboard}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("account_number", "\"0114584906\""));
collection.Add(new("routing_number", "\"129131673\""));
collection.Add(new("first_name", "\"John\""));
collection.Add(new("last_name", "\"Hancock\""));
collection.Add(new("account_type", "\"Personal Checking\""));
collection.Add(new("customer_id", "\"DjPnVDNApDDnVpMN\""));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
You will receive a BankAccount
object.
{
"data": {
"object": "BankAccount",
"id": "D634EdsD6KLd5ea",
"first_name": "John",
"last_name": "Hancock",
"account_type": "Personal Checking",
"routing_number": "129131673",
"account_number": "****4906"
},
"meta": {
"include": [],
"custom": []
}
}
Step 2: Create an ACH Charge
POST
https://testapi.payarc.net/v1/charges
We will create an ACH debit/credit movement using the bank account we already created at the previous step.
Remember from previous steps, the ID of our customer is DjPnVDNApDDnVpMN
.
We will debit
their account $12.01, which will be represented by the amount 1201
.
In order to create an ACH transfer, you will need to provide the SEC Code.
Payarc supports the following:
ARC
,BOC
,CCD
,POP
,PPD
,RCK
,TEL
,WEB
.
SEC Code Description Details ARC Accounts Receivable Entries A single ACH debit used by originator for the conversion of an eligible source document received via the U.S. mail or delivery service; at a lockbox location; or in person at a manned location for the payment of a bill. BOC Back Office Conversion A single ACH debit initiated by an originator based on an eligible source document provided at the point-of-purchase or at a manned bill payment location for subsequent conversion during back office conversion. CCD Corporate Credit or Debit A single or a recurring ACH credit or debit originated to a corporate account. They are commonly used by Originators to pay vendors, concentrate funds from outlying accounts (cash concentration), to fund payroll, petty cash, or other disbursement accounts. POP Point of Purchase A single ACH debit initiated by an originator based on an eligible source document provided at a point-of-purchase or manned bill payment location. PPD Pre-arranged Payment or Deposit A single or a recurring ACH credit or debit sent by an originator to a consumer account to make or collect a payment, where authorization is obtained in writing. RCK Re-presented Check Entries Originators can re-present a check that has been processed through the check collection system as a paper or image item, and returned because of insufficient or uncollected funds TEL Telephone Initiated Entries A single or a recurring ACH debit that occurs when the consumer’s authorization for a transfer of funds is received orally via the telephone. WEB Internet-Initiated/Mobile Entries Credit WEB Entries: A Person-to-Person entry transmitted on behalf of one natural person to another natural person, or between accounts belonging to the same natural person.
Debit WEB Entries: ACH entry initiated according to an authorization obtained via the internet or a wireless network (e.g. mobile device) except for an oral authorization via a telephone call.The full list of SEC codes is maintained by NACHA, the government entity that runs the ACH system. For further details, please refer to: https://achdevguide.nacha.org/ach-file-details
var request = require('request');
var options = {
'method': 'POST',
'url': 'http://localapi5.payarc.net/v1/achcharges',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}'
},
body: '{"currency":"usd","amount":"1201","type":"debit","sec_code":"WEB"}'
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://localapi5.payarc.net/v1/achcharges");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{Access-Token-From-Payarc-Dashboard}}");
var content = new StringContent("{\"currency\":\"usd\",\"amount\":\"1201\",\"type\":\"debit\",\"sec_code\":\"WEB\"}", null, "application/x-www-form-urlencoded");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
We will receive a ACHCharge
, in our case its ID is g9dDE7GDaA527eAa
{
"data": {
"object": "ACHCharge",
"id": "g9dDE7GDaA527eAa",
"amount": "1201",
"created_by": "[email protected]",
"status": "validated",
"type": "debit",
"authorization_id": 123,
"validation_code": "parola",
"successful": true,
"response_message": "Api call is proxied, check your env for locall",
"created_at": "2023-11-22T15:43:55.000000Z",
"updated_at": "2023-11-22T15:44:30.000000Z",
"retried_achcharge_id": null,
"bank_account": {
"data": {
"object": "BankAccount",
"id": "D634EdsD6KLd5ea",
"first_name": "John",
"last_name": "Hancock",
"account_type": "Personal Checking",
"sec_code": "WEB",
"routing_number": "129131673",
"account_number": "****4906"
}
}
},
"meta": {
"include": [],
"custom": []
}
}
Congratulations on creating an ACH Charge for an existing customer!
Updated 5 months ago