New in Chargebee: Explore Reveal and understand your payment performance end-to-end.

Creating BACS and BECS bank account payment sources via Chargebee API

Problem Statement

You want to create BACS or BECS bank account payment sources via Stripe using Chargebee's API, but the request fails with parameter or direct debit errors.

Common errors include:

  • Direct debit is not supported for this customer.
  • bank_account[routing_number] must be a 9-digit number.
  • Problem while adding the payment method. Error message : Missing required param: billing_details[address].

Solution

Use the Create a bank account payment source API and pass the bank account details with bank_account[billing_address]. For BACS and BECS via Stripe, the billing address JSON is mandatory because Stripe requires billing_details[address] for these direct debit payment methods.

Before creating the payment source, ensure the following:

  • BACS or BECS is enabled for Stripe in Chargebee and in your Stripe account.
  • The customer is eligible for direct debit.
  • The customer's preferred currency matches the direct debit scheme:
    • BACS: GBP
    • BECS: AUD
  • The bank account country matches the scheme:
    • BACS: GB
    • BECS: AU

Sample cURL for BACS via Stripe

Use this sample to create a BACS bank account payment source. Replace the placeholders with your site, API key, customer ID, and gateway account ID.

curl https://{site-name}.chargebee.com/api/v2/payment_sources/create_bank_account \
  -u {full-access-api-key}: \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "customer_id=16CLJEUoFmGvL87" \
  --data-urlencode "bank_account[gateway_account_id]=gw_AzqdxDSfmVXNv2PU" \
  --data-urlencode "bank_account[account_number]=00012345" \
  --data-urlencode "bank_account[routing_number]=108800" \
  --data-urlencode "bank_account[bank_name]=Stripe Test Bank" \
  --data-urlencode "bank_account[account_holder_type]=individual" \
  --data-urlencode "bank_account[account_type]=savings" \
  --data-urlencode "bank_account[first_name]=David" \
  --data-urlencode "bank_account[last_name]=Archer" \
  --data-urlencode "issuing_country=GB" \
  --data-urlencode "bank_account[company]=Chargebee" \
  --data-urlencode "bank_account[email]=test@example.com" \
  --data-urlencode "bank_account[billing_address]={\"first_name\":\"John\",\"last_name\":\"Doe\",\"line1\":\"49 Featherstone Street\",\"line2\":\"Suite 45\",\"country_code\":\"GB\",\"city\":\"London\",\"postal_code\":\"EC1Y 8SY\",\"email\":\"john.doe@example.com\"}"

Sample cURL for BECS via Stripe

Use this sample to create a BECS bank account payment source. Replace the placeholders with your site, API key, customer ID, and gateway account ID.

curl https://{site-name}.chargebee.com/api/v2/payment_sources/create_bank_account \
  -u {full-access-api-key}: \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "customer_id=16CLJEUoFok58dV" \
  --data-urlencode "bank_account[gateway_account_id]=gw_AzqdxDSfmVXNv2PU" \
  --data-urlencode "bank_account[account_number]=000123456" \
  --data-urlencode "bank_account[routing_number]=000-000" \
  --data-urlencode "bank_account[bank_name]=Stripe Test Bank" \
  --data-urlencode "bank_account[account_holder_type]=individual" \
  --data-urlencode "bank_account[account_type]=savings" \
  --data-urlencode "bank_account[first_name]=TestBecs" \
  --data-urlencode "bank_account[last_name]=Archer" \
  --data-urlencode "issuing_country=AU" \
  --data-urlencode "bank_account[company]=Chargebee" \
  --data-urlencode "bank_account[email]=test@example.com" \
  --data-urlencode "bank_account[billing_address]={\"first_name\":\"John\",\"last_name\":\"Doe\",\"line1\":\"49 Market Street\",\"line2\":\"Suite 45\",\"country_code\":\"AU\",\"city\":\"Sydney\",\"postal_code\":\"2000\",\"email\":\"john.doe@example.com\"}"

Troubleshooting

  • If you see Direct debit is not supported for this customer, verify that direct debit is enabled for the customer and that BACS or BECS via Stripe is enabled for the site.
  • If you see bank_account[routing_number] must be a 9-digit number, verify that the customer's preferred currency and bank account country match the direct debit scheme. BACS should use GBP and GB; BECS should use AUD and AU.
  • If you see Missing required param: billing_details[address], pass bank_account[billing_address] as a JSON object in the request.

Additional Information