Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment Methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Crypto
    Bank debits
      ACH Direct Debit
      Bacs Direct Debit
      Pre-authorised debit in Canada
      Australia BECS Direct Debit
        Accept a payment
        Save bank details
      New Zeland BECS Direct Debit
      SEPA Direct Debit
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
HomePaymentsAdd payment methodsBank debitsAustralia BECS Direct Debit

Save Australia BECS Direct Debit details for future payments

Use the Setup Intents API to save payment method details for future Australia BECS Direct Debit payments.

Use AuBECSDebitForm, Stripe’s pre-built BECS payment details collection UI, to create a payment form that lets you securely collect bank details without handling sensitive customer data. You can use the Setup Intents API to collect BECS Direct Debit payment method details in advance, and determine the final amount or payment date later. Use it to:

  • Save payment methods to a wallet to streamline future purchases
  • Collect surcharges after fulfilling a service
  • Start a free trial for a subscription

Set up Stripe
Server-side
Client-side

Server-side

This integration requires endpoints on your server that talk to the Stripe API. Use our official libraries for access to the Stripe API from your server:

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Client-side

The React Native SDK is open source and fully documented. Internally, it uses the native iOS and Android SDKs. To install Stripe’s React Native SDK, run one of the following commands in your project’s directory (depending on which package manager you use):

Command Line
yarn add @stripe/stripe-react-native

Next, install some other necessary dependencies:

  • For iOS, navigate to the ios directory and run pod install to ensure that you also install the required native dependencies.
  • For Android, there are no more dependencies to install.

Note

We recommend following the official TypeScript guide to add TypeScript support.

Stripe initialisation

To initialise Stripe in your React Native app, either wrap your payment screen with the StripeProvider component, or use the initStripe initialisation method. Only the API publishable key in publishableKey is required. The following example shows how to initialise Stripe using the StripeProvider component.

import { useState, useEffect } from 'react'; import { StripeProvider } from '@stripe/stripe-react-native'; function App() { const [publishableKey, setPublishableKey] = useState(''); const fetchPublishableKey = async () => { const key = await fetchKey(); // fetch key from your server here setPublishableKey(key); }; useEffect(() => { fetchPublishableKey(); }, []); return ( <StripeProvider publishableKey={publishableKey} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects > {/* Your app code here */} </StripeProvider> ); }

Note

Use your API test keys while you test and develop, and your live mode keys when you publish your app.

Create or retrieve a Customer
Server-side

To reuse a BECS Direct Debit account for future payments, you must attach it to a Customer.

Create a Customer object when your customer creates an account with your business. Associating the ID of the Customer object with your own internal representation of them enables you to retrieve and use the stored payment method details later.

Create a new Customer or retrieve an existing Customer to associate with this payment. Include the following code on your server to create a new Customer.

Command Line
cURL
curl -X POST https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"

Collect payment method details and mandate acknowledgment
Client-side

You can securely collect Australia BECS Direct Debit payment information with AuBECSDebitForm, a drop-in UI component provided by the SDK. AuBECSDebitForm provides a UI for customers to enter their name, email, BSB number, and account number in addition to displaying the Australia BECS Direct Debit Terms.

Add an AuBECSDebitForm component to the screen with your company name as a prop. You can also customize AuBECSDebitForm to match the look and feel of your app by providing the formStyle prop. Collect form details with the onComplete prop.

function BECSSetupFuturePaymentScreen() { const [formDetails, setFormDetails] = useState< AuBECSDebitFormComponent.FormDetails >(); return ( <View> <AuBECSDebitForm onComplete={(value) => setFormDetails(value)} companyName="Example Company Inc." formStyle={{ textColor: '#000000', fontSize: 22, placeholderColor: '#999999', }} /> <Button title="Save" variant="primary" onPress={handlePayPress} /> </View> ); }

Create a SetupIntent
Server-side
Client-side

Server-side

A SetupIntent is an object that represents your intent to set up a customer’s payment method for future payments. The SetupIntent will track the steps of this set-up process. For BECS Direct Debit, this includes collecting a mandate from the customer and tracking its validity throughout its lifecycle.

Create a SetupIntent on your server with payment_method_types set to au_becs_debit and specify the Customer’s id:

Command Line
curl
curl https://api.stripe.com/v1/setup_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="au_becs_debit" \ -d "customer"="{{CUSTOMER_ID}}"

After creating a SetupIntent on your server, you can associate the SetupIntent ID with the current session’s customer in your application’s data model. Doing so allows you to retrieve the information after you have successfully collected a payment method.

The returned SetupIntent object contains a client_secret property. Pass the client secret to the client-side application to continue with the setup process.

Client-side

On the client, request a SetupIntent from your server and store its client secret.

const fetchSetupIntentClientSecret = async (customerEmail: string) => { const response = await fetch(`${API_URL}/create-setup-intent`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ email: customerEmail, payment_method_types: ['au_becs_debit'], }), }); const {clientSecret, error} = await response.json(); return {clientSecret, error}; };

Submit the payment method details to Stripe
Client-side

Retrieve the client secret from the SetupIntent you created and call confirmSetupIntent. This presents a webview where the customer can complete the setup on their bank’s website or app.

function BECSSetupFuturePaymentScreen() { const { confirmSetupIntent } = useConfirmSetupIntent(); const [formDetails, setFormDetails] = useState< AuBECSDebitFormComponent.FormDetails >(); const handlePayPress = async () => { const { error, setupIntent } = await confirmSetupIntent(clientSecret, { paymentMethodType: 'AuBecsDebit', paymentMethodData: { formDetails, } }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); console.log('Setup intent confirmation error', error.message); } else if (setupIntent) { Alert.alert( `Success: Setup intent created. Intent status: ${setupIntent.status}` ); } }; return ( <View> <AuBECSDebitForm onComplete={(value) => setFormDetails(value)} companyName="Example Company Inc." formStyle={{ textColor: '#000000', fontSize: 22, placeholderColor: '#999999', }} /> <Button title="Save" variant="primary" onPress={handlePayPress} /> </View> ); }

Test the integration

Test your form using the test BSB number 000-000 and one of the test account numbers below when you call confirmSetupIntent.

BSB NumberAccount NumberDescription
000-000000123456The PaymentIntent created with the resulting PaymentMethod transitions from processing to succeeded. The mandate status remains active.
000-000900123456The PaymentIntent created with the resulting PaymentMethod transitions from processing to succeeded (with a three-minute delay). The mandate status remains active.
000-000111111113The PaymentIntent created with the resulting PaymentMethod transitions from processing to requires_payment_method with an account_closed failure code. The mandate status becomes inactive at that point.
000-000111111116The PaymentIntent created with the resulting PaymentMethod transitions from processing to requires_payment_method with a no_account failure code. The mandate status becomes inactive at that point.
000-000222222227The PaymentIntent created with the resulting PaymentMethod transitions from processing to requires_payment_method with a refer_to_customer failure code. The mandate status remains active.
000-000922222227The PaymentIntent created with the resulting PaymentMethod transitions from processing to requires_payment_method with a refer_to_customer failure code (with a three-minute delay). The mandate status remains active.
000-000333333335The PaymentIntent created with the resulting PaymentMethod transitions from processing to requires_payment_method with a debit_not_authorized failure code. The mandate status becomes inactive at that point.
000-000666666660The PaymentIntent created with the resulting PaymentMethod transitions from processing to succeeded, but a dispute is immediately created.
000-000343434343The PaymentIntent that was created with the resulting PaymentMethod fails with a charge_exceeds_source_limit error due to the payment amount causing the account to exceed its weekly payment volume limit.
000-000121212121The PaymentIntent that was created with the resulting PaymentMethod fails with a charge_exceeds_transaction_limit error due to the payment amount exceeding the account’s transaction volume limit.

See also

  • Accept an Australia BECS Direct Debit payment
  • Connect payments
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access programme.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc