Use eChecks
Last updated: 03-Mar-2025
Rate this article:
Overview
eChecks (electronic checks) are a secure, efficient, and cost-effective digital payment method that allows merchants to process payments directly from a customer's bank account. Using the Automated Clearing House (ACH) network, eChecks streamline transactions by replacing traditional paper checks with electronic processing.
This method is ideal for recurring payments, large transactions, or industries where ACH payments are commonly used.
Supported currencies
eChecks support only USD transactions.
Workflow
- Collect the following information from your customers:
- Account holder name
- Bank Routing number
- Account number
- Account type
- Use value "S" for SAVINGS accounts and "C" for CHECKING accounts in API
- Create the order object. Use DIRECT_DEBIT_ACH as the type in the PaymentDetails object and pass the collected information through the PaymentMethod object.
- Place the order.
Request parameters
Parameters | Type/Description |
---|---|
sessionID | Required (string) Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Order | Required (Object) Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. See code sample for more details. |
Request example
<?php
declare(strict_types=1);
class Configuration
{
public const MERCHANT_CODE = 'MERCHANT';
public const MERCHANT_KEY = 'SECRET_KEY';
public const URL = 'https://api.2checkout.com/soap/6.0';
public const ACTION = 'placeOrder';
public const PAYLOAD = <<<JSON
{
"Currency": "USD",
"Language": "EN",
"Country": "us",
"CustomerIP": "91.220.121.21",
"Source": "sourceAPI.net",
"LocalTime": "2022-01-13 09:41:59",
"CustomerReference": 421820775,
"Items": [
{
"Code": "TA-TuneUp-M-RENEW"
}
],
"BillingDetails": {
"Address1": "Test Address",
"City": "LA",
"State": "California",
"CountryCode": "US",
"Email": "testcustomer@2Checkout.com",
"FirstName": "Customer",
"LastName": "2Checkout",
"Zip": "12345"
},
"PaymentDetails": {
"Type": "DIRECT_DEBIT_ACH",
"Currency": "USD",
"CustomerIP": "91.220.121.21",
"PaymentMethod": {
"AccountHolderName": "John Doe",
"BankRoutingNumber": "222371863",
"AccountNumber": "999999999",
"AccountType": "S",
"RecurringEnabled": true
}
}
}
JSON;
}
class Client
{
public function call(
string $url = Configuration::URL,
$payload = Configuration::PAYLOAD,
string $action = Configuration::ACTION
): ?object {
if (is_array($payload)) {
$payload = json_encode($payload);
}
if (!empty($payload)) {
// SoapClient works with objects(StdClass)
$payload = json_decode($payload);
}
$soapClient = $this->getClient($url);
$sessionId = $this->getSession($soapClient);
$args = array_filter([$sessionId, $payload]);
return $soapClient->$action(...$args);
}
public function getClient(string $url): SoapClient
{
return new SoapClient(
$url.'?wsdl',
[
'location' => $url,
'cache_wsdl' => WSDL_CACHE_NONE,
]
);
}
public function getSession(SoapClient $client)
{
$date = gmdate('Y-m-d H:i:s');
$merchantCode = Configuration::MERCHANT_CODE;
$key = Configuration::MERCHANT_KEY;
$string = strlen($merchantCode).$merchantCode.strlen($date).$date;
$algo = 'sha256';
$hash = hash_hmac($algo, $string, $key);
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');
return $client->login($merchantCode, $date, $hash, $algo);
}
}
try {
$client = new Client();
var_dump($client->call());
} catch (Exception $ex) {
var_dump($ex);
}
Response Parameters
Parameter | Type/Description |
---|---|
Order information | Object Object containing order information. |
Rate this article: