Bank Direct Debit
Withdraw funds from your customers’ bank accounts.
Bank direct debit is an authorized withdrawal from your customer's bank account. Direct debits are typically used in recurring transactions such as bill payments, memberships and subscriptions. Direct debit functionality is only available in select countries where the capability exists as part of a banking network.
Popular direct debit capable schemes include:
Bacs in the UK.
ACH in the US, Canada (ACSS).
BECs in Australia.
GIRO in Singapore.
SEPA in the EU. See List of SEPA Supported Countries (You must be domiciled here in order to accept SEPA payments)
Andorra, Austria, Belgium, Bulgaria, Cypress, Czech Republic, Denmark, Estonia, Finland, France, Germany, Gibraltar, Greece, Holy See, Hungary, Ireland, Iceland, Italy, Liechtenstein, Lithuania, Luxembourg, Monaco, Malta, Netherlands, Norway, Poland, Portugal, Romania, San Marino, Spain, Slovenia, Slovakia, Sweden, Switzerland
The direct debit process below explains how to:
Add direct debit payments to your business workflow.
Create direct debit payment request.
Capture the payment response.
Rapyd Network Rules
Participants in the Rapyd Network are subject to the Rapyd Network Rules. Any use of or participation of the Rapyd Network not covered in the Rapyd Network Rules will be governed by applicable participation agreements and associated documentation.
The following example represents an ACH Direct Debit checkout page workflow.
Proof of Authorization Form
Your customer must sign a proof of authorization form that complies with Rapyd's ACH network rules. For more information, see section 13 - Web Initiated ACH Entries of Rapyd Network Rules. You must maintain a copy of this form in your records.
Enter your account information.
Click Place Your Order.
Follow the payment instructions to complete the payment.
Click Finish.
Finding the specific bank direct debit payment methods you'll accept and the corresponding required fields that customers fill out is described under How it Works.
Customer selects SEPA payment.
You ask Rapyd to process request.
Rapyd processes the request and sends the redirect URL.
You present the redirect URL to customer.
Customer signs the SEPA mandate.
Customer completes the ACH bank transfer payment.
Your website back end asks Rapyd to process the ACH bank transfer payment.
Rapyd processes the payment and responds with details of the transaction.
The website back end is notified by Rapyd when the payment is completed successfully.
Decide the bank direct debit payment methods you will accept, so your customer can specify their payment methods on your payment page. To do that, use List Payment Methods by Country with the following parameters:
Available countries can be listed with the List Countries API call.
For illustration purposes, we will use US and USD for country and currency in the sample codes below. US ACH is the direct debit payment type.
Description of Query Parameters
Query Parameter | Description |
---|---|
country | Enter US as the ISO ALPHA-2 country code country code for the United States. |
currency | Enter USD as the currency code for United States dollars. |
Request
// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/country?country=US¤cy=USD // Message body absent
.NET Core
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string country = "US"; string currency = "USD"; string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/payment_methods/country?country={country}¤cy={currency}"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const result = await makeRequest('GET', '/v1/payment_methods/country?country=US¤cy=USD'); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); try { $object = make_request('get', '/v1/payment_methods/country?country=US¤cy=USD'); var_dump($object); } catch (Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request country = 'US' currency = 'USD' results = make_request(method='get', path=f'/v1/payment_methods/country?country={country}¤cy={currency}') pprint(results))
List Payment Methods by Country Response
List Payments Methods by Country describes the fields in the response.
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "90ebf1ec-9e40-49f6-9175-b3a764ab3cd0" }, "data": [ { "type": "us_ach_bank", "name": "Evolve Bank & Trust ", "category": "bank_transfer", "image": "https://iconslib.rapyd.net/checkout/us_ach_bank.png", "country": "us", "payment_flow_type": "bank_transfer", "currencies": [ "USD" ], "status": 1, "is_cancelable": false, "payment_options": [], "is_expirable": false, "is_online": false, "minimum_expiration_seconds": null, "maximum_expiration_seconds": null } ] }
The data
section of this response shows that us_ach_bank is a supported payment method.
List Payment Methods Response
A full API response lists many payment methods.
Identify the fields that your customer needs to complete for the payment method. To do that, use Get Payment Method Required Fields with the following parameter:
Description of Path Parameters
Path Parameter | Description |
---|---|
type | Enter us_ach_bank as the payment method type. |
Request a set of required fields for a us_ach_bank payment.
Request
// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/us_ach_bank/required_fields // Message body absent
.NET Core
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string type = "us_ach_bank"; string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/payment_methods/{type}/required_fields"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const result = await makeRequest('GET', '/v1/payment_methods/us_ach_bank/required_fields'); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); try { $object = make_request('get', '/v1/payment_methods/us_ach_bank/required_fields'); var_dump($object); } catch (Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request payment_method = 'us_ach_bank' results = make_request(method='get', path=f'/v1/payment_methods/us_ach_bank/required_fields') pprint(results)
Get Payment Method Required Fields describes the fields in the response.
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "058bc78e-49aa-4370-b0b4-3635950173ac" }, "data": { "type": "us_ach_bank", "fields": [ { "name": "proof_of_authorization", "type": "boolean", "regex": "", "description": "", "is_required": true, "is_updatable": false }, { "name": "first_name", "type": "string", "regex": "", "description": "", "is_required": false, "is_updatable": false }, { "name": "last_name", "type": "string", "regex": "", "description": "", "is_required": false, "is_updatable": false }, { "name": "company_name", "type": "string", "regex": "", "description": "", "is_required": false, "is_updatable": false }, { "name": "routing_number", "type": "string", "regex": "^([0-9]){9,9}$", "description": "", "is_required": true, "is_updatable": false }, { "name": "payment_purpose", "type": "string", "regex": "(PAYMENT|VENDOR PMT)", "description": "", "is_required": true, "is_updatable": false }, { "name": "account_number", "type": "string", "regex": "^([0-9]){1,34}$", "description": "", "is_required": true, "is_updatable": false } ], "payment_method_options": [], "payment_options": [], "minimum_expiration_seconds": null, "maximum_expiration_seconds": null } }
The data
section of this response shows that the following fields are required for a us_ach_bank payment:
proof_of_authorization
routing_number
payment_purpose
account_number
The following fields are optional:
first_name
last_name
company_name
When your customer pays a loan on your website, create a request called Create Payment, using the following parameters, for Rapyd to process the ACH bank transfer payment:
Description of Body Parameters
Body Parameter | Description |
---|---|
amount | Enter 2100 as the payment amount. |
currency | Enter USD as the currency code for US dollars. |
payment_method | Enter an object with the following fields:
|
Request Rapyd to process your customer's payment (of 2,100.00 USD) as an ACH bank transfer.
Request
// Request URL: POST https://sandboxapi.rapyd.net/v1/payments // Message body: { "amount": 2100, "currency": "USD", "payment_method": { "type": "us_ach_bank", "fields": { "proof_of_authorization": true, "first_name": "Test", "last_name": "User", "company_name": "Acme", "routing_number": "123UA34599", "payment_purpose": "Loan payment", "account_number": "USA_2340234-098-0908g" } } }
.NET Core
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { var requestObj = new { amount = 2100, currency = "USD", payment_method = new { type = "us_ach_bank", fields = new { proof_of_authorization = true, first_name = "Test", last_name = "User", company_name = "Acme", routing_number = "123UA34599", payment_purpose = "Loan payment", account_number = "USA_2340234-098-0908g", } } }; string request = JsonSerializer.Serialize(requestObj); string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/payments", request); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const body = { amount: 2100, currency: 'USD', payment_method: { type: 'us_ach_bank', fields: { proof_of_authorization: true, first_name: 'Test', last_name: 'User', company_name: 'Acme', routing_number: '123UA34599', payment_purpose: 'Loan payment', account_number: 'USA_2340234to098to0908g' } } }; const result = await makeRequest('POST', '/v1/payments', body); console.log(result); } catch (error) { console.error('Error completing request', error); } }
Python
from pprint import pprint from utilities import make_request payment_body = { "amount": 2100, "currency": "USD", "payment_method": { "type": "us_ach_bank", "fields": { "proof_of_authorization": true, "first_name": "Test", "last_name": "User", "company_name": "Acme", "routing_number": "123UA34599", "payment_purpose": "Loan payment", "account_number": "USA_2340234to098to0908g" } } } create_payment_response = make_request(method='post', path='/v1/payments', body=payment_body) pprint(create_payment_response) pprint(results)
Create Payment describes the fields in the response.
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "3ae269bc-11ff-477b-9f2a-ce69786876dc" }, "data": { "id": "payment_a7ed3e41026614bc9e1d50981c099e07", "amount": 0, "original_amount": 2100, // ... "currency_code": "USD", "country_code": "us", "status": "ACT", // ... "customer_token": "cus_722c2234e6f83c5249b5376d743737cc", "payment_method": "other_1a06a5f97f4b0ff901d61f3ea704b296", // ... "created_at": 1583408200, // ... "paid": false, // ... "payment_method_type": "us_ach_bank", "payment_method_type_category": "bank_transfer", // ... } }
The data
section of this response shows:
The payment
id
is payment_a7ed3e41026614bc9e1d50981c099e07. When you run this in your own sandbox, you will get a different ID, which you will need for a later step.The
original_amount
of the payment is 2100. You will need this value for a later step.The
currency_code
is USD .The
status
is ACT. This means that the payment process is active and awaiting completion. Payment Object lists possible values forstatus
.
Simulate Payment Completion
The sandbox does not directly simulate the action that completes a payment. You can simulate this action with the procedure described in Complete Payment. To do that, you will need the following values from the response you received when you ran 'Create Payment' in your sandbox:
payment id
code
(in thetextual_codes
object)original_amount
When a payment is completed, Rapyd sends a webhook. Before you run 'Complete Payment', configure your system to receive webhooks with the procedure described in Defining a Webhook Endpoint .
After you simulate the transfer of funds by your customer's bank, Rapyd sends you a webhook Webhook - Payment Completed to confirm that the payment was completed.