# Accept an Australia BECS Direct Debit payment Learn to accept Australia BECS Direct Debit payments. # Pagamento > This is a Pagamento for when payment-ui is checkout. View the full page at https://docs.stripe.com/payments/au-becs-debit/accept-a-payment?payment-ui=checkout. > Stripe può presentare automaticamente i metodi di pagamento pertinenti ai tuoi clienti valutando la valuta, le limitazioni relative ai metodi di pagamento e altri parametri. > > - Segui la guida [Accettare un pagamento](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=checkout&ui=stripe-hosted) per creare un’integrazione di checkout che utilizzi [metodi di pagamento dinamici](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods.md). - Se non desideri utilizzare metodi di pagamento dinamici, segui i passaggi riportati di seguito per configurare manualmente i metodi di pagamento nell’integrazione Checkout. Stripe users in Australia can use [Checkout](https://docs.stripe.com/payments/checkout.md) in payment mode to accept Australia BECS Direct Debit payments. A [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md) represents the details of your customer’s intent to purchase. You create a Checkout Session when your customer wants to pay for something. After redirecting your customer to a Checkout Session, Stripe presents a payment form where your customer can complete their purchase. When your customer has completed a purchase, they’re redirected back to your site. ## Determinare la compatibilità **Area geografica del cliente**: Australia **Valute accettate**: `aud` **Valute di pagamento**: `aud` **Metodi di pagamento**: Yes **Modalità di configurazione**: Yes **Modalità di abbonamento**: Yes To support BECS Direct Debit payments in Checkout, *Prices* (Prices define how much and how often to charge for products. This includes how much the product costs, what currency to use, and the interval if the price is for subscriptions) for all line items must be expressed in Australian dollars (currency code `aud`). ## Accettare un pagamento > Crea un’integrazione per [accettare un pagamento](https://docs.stripe.com/payments/accept-a-payment.md?integration=checkout) con Checkout prima di utilizzare questa guida. Use this guide to learn how to enable BECS Direct Debit—it shows the differences between accepting payments using dynamic payment methods and manually configuring payment methods. ### Enable BECS Direct Debit as a payment method Quando crei una nuova [sessione di Checkout](https://docs.stripe.com/api/checkout/sessions.md), devi: 1. Add `au_becs_debit` to the list of `payment_method_types` 1. Make sure all your `line_items` use the `aud` currency #### Pagina in hosting su Stripe ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "line_items[0][price_data][currency]=aud" \ -d "line_items[0][price_data][product_data][name]=T-shirt" \ -d "line_items[0][price_data][unit_amount]=2000" \ -d "line_items[0][quantity]=1" \ -d mode=payment \ -d "payment_method_types[0]=card" \ -d "payment_method_types[1]=au_becs_debit" \ --data-urlencode "success_url=https://example.com/success" ``` #### Full embedded page ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d "line_items[0][price_data][currency]=aud" \ -d "line_items[0][price_data][product_data][name]=T-shirt" \ -d "line_items[0][price_data][unit_amount]=2000" \ -d "line_items[0][quantity]=1" \ -d mode=payment \ -d "payment_method_types[0]=card" \ -d "payment_method_types[1]=au_becs_debit" \ --data-urlencode "return_url=https://example.com/return" \ -d ui_mode=embedded_page ``` ### Evadere gli ordini Dopo aver accettato un pagamento, scopri come evadere gli [ordini](https://docs.stripe.com/checkout/fulfillment.md). ## Testare l'integrazione > You’ll want to use the [BECS Direct Debit test numbers](https://docs.stripe.com/payments/au-becs-debit/accept-a-payment.md#test-integration) when testing your Checkout integration with BECS Direct Debit. There are several test numbers you can use to make sure your integration is ready for production. | Numero BSB | Numero di conto | Token | Descrizione | | ---------- | --------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `000000` | `000123456` | `pm_auBecsDebit_success` | Lo stato del PaymentIntent passa da `processing` a `succeeded`. Lo stato del mandato rimane `active`. | | `000000` | `900123456` | `pm_auBecsDebit_successDelayed` | Lo stato del PaymentIntent passa da `processing` a `succeeded` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `111111113` | `pm_auBecsDebit_accountClosed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `account_closed`. Lo stato del mandato diventa `inactive`. | | `000000` | `111111116` | `pm_auBecsDebit_noAccount` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `no_account`. Lo stato del mandato diventa `inactive`. | | `000000` | `222222227` | `pm_auBecsDebit_referToCustomer` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer`. Lo stato del mandato rimane `active`. | | `000000` | `922222227` | `pm_auBecsDebit_referToCustomerDelayed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `333333335` | `pm_auBecsDebit_debitNotAuthorized` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `debit_not_authorized`. Lo stato del mandato diventa `inactive`. | | `000000` | `666666660` | `pm_auBecsDebit_dispute` | Lo stato di PaymentIntent passa da `processing` a `succeeded`, ma viene creata immediatamente una contestazione. | | `000000` | `343434343` | `pm_auBecsDebit_exceedsWeeklyLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_source_limit` dovuto all’importo del pagamento che ha causato il superamento del limite del volume di pagamento settimanale. | | `000000` | `121212121` | `pm_auBecsDebit_exceedsTransactionLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_transaction_limit` a causa dell’importo del pagamento che supera il limite del volume delle transazioni dell’account. | ## Gestire rimborsi e contestazioni; The refund period for BECS Direct Debit is up to 90 days after the original payment. Customers can dispute a payment through their bank up to 7 years after the original payment and there is no appeals process. Learn more about [BECS Direct Debit disputes](https://docs.stripe.com/payments/au-becs-debit.md). ## Optional: Configure customer debit date You can control the date that Stripe debits a customer’s bank account using the [target date](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-payment_method_options-au_becs_debit-target_date). The target date must be at least three days in the future and no more than 15 days from the current date. The target date schedules money to leave the customer’s account on the target date. Target dates that meet one of the following criteria delay the debit until the next available business day: - Target date falls on a weekend, a bank holiday, or other non-business day. - Target date is fewer than three business days in the future. This parameter operates on a best-effort basis. Each customer’s bank might process debits on different dates, depending on local bank holidays or other reasons. ## See also - [Managing mandates](https://docs.stripe.com/payments/au-becs-debit.md#mandates) - [Checkout fulfillment](https://docs.stripe.com/checkout/fulfillment.md) - [Customizing Checkout](https://docs.stripe.com/payments/checkout/customization.md) - [Save BECS Direct Debit details for future payments](https://docs.stripe.com/payments/au-becs-debit/set-up-payment.md) - [Connect payments](https://docs.stripe.com/connect/charges.md) # Checkout Sessions API > This is a Checkout Sessions API for when payment-ui is elements and api-integration is checkout. View the full page at https://docs.stripe.com/payments/au-becs-debit/accept-a-payment?payment-ui=elements&api-integration=checkout. Per determinare quale API soddisfa le esigenze della tua azienda, consulta la [Guida al confronto](https://docs.stripe.com/payments/checkout-sessions-and-payment-intents-comparison.md). Utilizza [Payment Element](https://docs.stripe.com/payments/payment-element.md) per integrare un modulo di pagamento Stripe personalizzato nel tuo sito web o nella tua applicazione e offrire metodi di pagamento ai clienti. Per configurazioni e personalizzazioni avanzate, consulta la guida all’integrazione [Accettare un pagamento](https://docs.stripe.com/payments/accept-a-payment.md). ## Determine compatibility **Area geografica del cliente**: Australia **Valute accettate**: `aud` **Valute di pagamento**: `aud` **Metodi di pagamento**: Yes **Modalità di configurazione**: Yes **Modalità di abbonamento**: Yes A Checkout Session must satisfy all of the following conditions to support Australia BECS Direct Debit payments: - *Prices* (Prices define how much and how often to charge for products. This includes how much the product costs, what currency to use, and the interval if the price is for subscriptions) for all line items must be expressed in Australian dollars (currency code `aud`). ## Set up the server [Lato server] Utilizza le librerie ufficiali di Stripe per accedere all’API dalla tua applicazione. #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ## Create or retrieve a customer [Lato server] To reuse a BECS Direct Debit account for future payments, attach it to an object that represents your customer. > #### Utilizza l'API Accounts v2 per rappresentare i clienti > > L’API Accounts v2 è generalmente disponibile per gli utenti Connect e in anteprima pubblica per altri utenti Stripe. Se fai parte dell’anteprima di Accounts v2, devi specificare una [versione di anteprima](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) nel tuo codice. > > Per richiedere l’accesso all’anteprima di Accounts v2, > > Nella maggior parte dei casi d’uso, consigliamo di [rappresentare i clienti come oggetti Account configurati dall’utente,](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) anziché utilizzare oggetti [Customer](https://docs.stripe.com/api/customers.md). Create a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) or [Customer](https://docs.stripe.com/api/customers/create.md) when your customer creates an account with your business, or when saving a payment method. Associate the object’s ID with your own internal representation of a customer. Create a new customer or retrieve an existing one to associate with this payment. #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-04-22.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## Create a Checkout Session [Lato server] Aggiungi sul server un endpoint che crei una [sessione di Checkout](https://docs.stripe.com/api/checkout/sessions/create.md) e restituisca la sua [chiave privata client](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-client_secret) al tuo front-end. Una sessione di Checkout rappresenta la sessione in cui il cliente completa acquisti una tantum o sottoscrive abbonamenti. Le sessioni di Checkout scadono 24 ore dopo la creazione. We recommend using [dynamic payment methods](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods.md) to dynamically display the most relevant eligible payment methods to each customer to maximize conversion. You can also [manually list payment methods](https://docs.stripe.com/payments/payment-methods/integration-options.md#listing-payment-methods-manually), which disables dynamic payment methods. #### Gestire le modalità di pagamento dalla Dashboard #### TypeScript ```javascript import express, {Express} from 'express'; const app: Express = express(); app.post('/create-checkout-session', async (req: Express.Request, res: Express.Response) => { const session = await stripe.checkout.sessions.create({ line_items: [ { price_data: { currency: 'aud', product_data: { name: 'T-shirt', }, unit_amount: 1099, }, quantity: 1, }, ], mode: 'payment', ui_mode: 'elements', return_url: 'https://example.com/return?session_id={CHECKOUT_SESSION_ID}' }); res.json({checkoutSessionClientSecret: session.client_secret}); }); app.listen(3000, () => { console.log('Running on port 3000'); }); ``` #### Manually list payment methods #### TypeScript ```javascript import express, {Express} from 'express'; const app: Express = express(); app.post('/create-checkout-session', async (req: Express.Request, res: Express.Response) => { const session = await stripe.checkout.sessions.create({ line_items: [ { price_data: { currency: 'aud', product_data: { name: 'T-shirt', }, unit_amount: 1099, }, quantity: 1, }, ], mode: 'payment', ui_mode: 'elements', payment_method_types: ['au_becs_debit'], return_url: 'https://example.com/return?session_id={CHECKOUT_SESSION_ID}' }); res.json({checkoutSessionClientSecret: session.client_secret}); }); app.listen(3000, () => { console.log('Running on port 3000'); }); ``` ## Configurare il front-end [Lato client] #### HTML + JS Includi lo script Stripe.js nella tua pagina di checkout aggiungendolo al valore `head` del tuo file HTML. Carica sempre Stripe.js direttamente da js.stripe.com per garantire la conformità PCI. Non includere lo script in un pacchetto e non utilizzarne una copia in self-hosting. Assicurati di utilizzare la versione più recente di Stripe includendo il seguente tag nello script ``. Ulteriori informazioni sul [controllo delle versioni di Stripe.js](https://docs.stripe.com/sdks/stripejs-versioning.md). ```html Checkout ``` > Stripe fornisce un pacchetto npm che puoi utilizzare per caricare Stripe.js come modulo. Consulta il [progetto su GitHub](https://github.com/stripe/stripe-js). È richiesta la versione [7.0.0](https://www.npmjs.com/package/%40stripe/stripe-js/v/7.0.0) o versioni successive. Inizializza Stripe.js ```js // Set your publishable key: remember to change this to your live publishable key in production // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe( '<>', ); ``` #### React Installa [React Stripe.js](https://www.npmjs.com/package/@stripe/react-stripe-js) e il [caricatore Stripe.js](https://www.npmjs.com/package/@stripe/stripe-js) dal registro pubblico npm. È necessaria almeno la versione 5.0.0 per React Stripe.js e la versione 8.0.0 per il caricatore Stripe.js. ```bash npm install --save @stripe/react-stripe-js@^5.0.0 @stripe/stripe-js@^8.0.0 ``` Inizializza un’istanza `stripe` sul front-end con la tua chiave pubblicabile. ```javascript import {loadStripe} from '@stripe/stripe-js'; const stripe = loadStripe("<>"); ``` ## Initialize Checkout [Lato client] #### HTML + JS Chiama [initCheckoutElementsSdk](https://docs.stripe.com/js/custom_checkout/init), specificando `clientSecret`. `initCheckoutElementsSdk` restituisce un oggetto [Checkout](https://docs.stripe.com/js/custom_checkout) che contiene i dati della sessione di checkout e i metodi per aggiornarla. Leggi `total` e `lineItems` da [actions.getSession()](https://docs.stripe.com/js/custom_checkout/session), e mostrali nella tua interfaccia utente. Ciò consente di attivare nuove funzioni con modifiche minime al codice. Ad esempio, l’aggiunta dei [prezzi in valuta manuali](https://docs.stripe.com/payments/custom/localize-prices/manual-currency-prices.md) non richiede alcuna modifica all’interfaccia utente se mostri `total`. ```html
``` ```javascript const clientSecret = fetch('/create-checkout-session', {method: 'POST'}) .then((response) => response.json()) .then((json) => json.client_secret); const checkout = stripe.initCheckoutElementsSdk({clientSecret}); const loadActionsResult = await checkout.loadActions(); if (loadActionsResult.type === 'success') { const session = loadActionsResult.actions.getSession(); const checkoutContainer = document.getElementById('checkout-container'); checkoutContainer.append(JSON.stringify(session.lineItems, null, 2)); checkoutContainer.append(document.createElement('br')); checkoutContainer.append(`Total: ${session.total.total.amount}`); } ``` #### React Includi la tua richiesta di registrazione con il componente [CheckoutElementsProvider](https://docs.stripe.com/js/react_stripe_js/checkout/checkout_provider), specificando `clientSecret` e l’istanza `stripe`. ```jsx import React from 'react'; import {CheckoutElementsProvider} from '@stripe/react-stripe-js/checkout'; import CheckoutForm from './CheckoutForm'; const clientSecret = fetch('/create-checkout-session', {method: 'POST'}) .then((response) => response.json()) .then((json) => json.client_secret); const App = () => { return ( ); }; export default App; ``` Accedi all’oggetto [Checkout](https://docs.stripe.com/js/custom_checkout) nel componente del tuo modulo di checkout utilizzando l’hook `useCheckoutElements()`. L’oggetto `Checkout` contiene i dati della Checkout Session e i metodi per aggiornarla. Leggi `total` and `lineItems` dall’oggetto `Checkout` e visualizzali nell’interfaccia utente. In questo modo puoi abilitare le funzioni con modifiche minime al codice. Ad esempio, l’aggiunta di [prezzi di valuta manuali](https://docs.stripe.com/payments/custom/localize-prices/manual-currency-prices.md) non richiede modifiche all’interfaccia utente se visualizzi `total`. ```jsx import React from 'react'; import {useCheckoutElements} from '@stripe/react-stripe-js/checkout'; const CheckoutForm = () => {const checkoutState = useCheckoutElements(); if (checkoutState.type === 'loading') { return (
Loading...
); } if (checkoutState.type === 'error') { return (
Error: {checkoutState.error.message}
); } return (
{JSON.stringify(checkoutState.checkout.lineItems, null, 2)} {/* A formatted total amount */} Total: {checkoutState.checkout.total.total.amount}
); }; ``` ## Collect customer email [Lato client] #### HTML + JS Al completamento di una sessione di Checkout, devi fornire un’email cliente valida. Queste istruzioni creano un inserimento email e utilizzano [updateEmail](https://docs.stripe.com/js/custom_checkout/update_email) dall’oggetto `Checkout`. In alternativa: - Specifica [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email), [customer_account](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_account) (per i clienti rappresentati come oggetti `Account` configurati dal cliente) o [customer](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer) (per i clienti rappresentati come oggetti `customer`) durante la creazione della sessione di Checkout. Stripe convalida le email fornite in questo modo. - Inserisci un’email che hai già convalidato su [Checkout.confirm](https://docs.stripe.com/js/custom_checkout/confirm). ```html
``` ```javascript const checkout = stripe.initCheckoutElementsSdk({clientSecret}); const loadActionsResult = await checkout.loadActions(); if (loadActionsResult.type === 'success') { const {actions} = loadActionsResult; const emailInput = document.getElementById('email'); const emailErrors = document.getElementById('email-errors'); emailInput.addEventListener('input', () => { // Clear any validation errors emailErrors.textContent = ''; }); emailInput.addEventListener('blur', () => { const newEmail = emailInput.value;actions.updateEmail(newEmail).then((result) => { if (result.error) { emailErrors.textContent = result.error.message; } }); }); } ``` #### React Al completamento di una sessione di Checkout, devi fornire un’email cliente valida. Queste istruzioni creano un inserimento email e utilizzano [updateEmail](https://docs.stripe.com/js/react_stripe_js/checkout/update_email) dall’oggetto `Checkout`. In alternativa: - Specifica [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email), [customer_account](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_account) (per i clienti rappresentati come oggetti `Account` configurati dal cliente) o [customer](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer) (per i clienti rappresentati come oggetti `customer`) durante la creazione della sessione di Checkout. Stripe convalida le email fornite in questo modo. - Inserisci un’email che hai già convalidato al momento della [conferma](https://docs.stripe.com/js/react_stripe_js/checkout/confirm). ```jsx import React from 'react'; import {useCheckoutElements} from '@stripe/react-stripe-js/checkout'; const EmailInput = () => { const checkoutState = useCheckoutElements(); const [email, setEmail] = React.useState(''); const [error, setError] = React.useState(null); if (checkoutState.type === 'loading') { return (
Loading...
); } else if (checkoutState.type === 'error') { return (
Error: {checkoutState.error.message}
); } const handleBlur = () => {checkoutState.checkout.updateEmail(email).then((result) => { if (result.type === 'error') { setError(result.error); } }) }; const handleChange = (e) => { setError(null); setEmail(e.target.value); }; return (
{error &&
{error.message}
}
); }; export default EmailInput; ``` ## Collect payment details [Lato client] Raccogli i dati di pagamento sul client con [Payment Element](https://docs.stripe.com/payments/payment-element.md). Payment Element è un componente di interfaccia utente preintegrato che semplifica la raccolta dei dati di pagamento per vari metodi di pagamento. Payment Element contiene un iframe che invia a Stripe le informazioni sul pagamento in modo sicuro tramite una connessione HTTPS. Evita di inserire Payment Element all’interno di un altro iframe, perché alcuni metodi di pagamento richiedono il reindirizzamento a un’altra pagina per la conferma del pagamento. Se scegli di utilizzare un iframe e desideri accettare Apple Pay o Google Pay, l’iframe deve avere l’attributo [allow](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allowpaymentrequest) impostato su `"payment *"`. Affinché l’integrazione funzioni, l’indirizzo della pagina di checkout deve iniziare con `https://` rather anziché con `http://` for. Puoi testare l’integrazione senza usare HTTPS, ma ricorda di [abilitarlo](https://docs.stripe.com/security/guide.md#tls) quando sarà tutto pronto per accettare i pagamenti in modalità live. #### HTML + JS Innanzitutto, crea un elemento DOM del contenitore per montare [Payment Element](https://docs.stripe.com/payments/payment-element.md). Poi crea un’istanza di `Payment Element` utilizzando [checkout.createPaymentElement](https://docs.stripe.com/js/custom_checkout/create_payment_element) e montala chiamando [element.mount](https://docs.stripe.com/js/element/mount), fornendo un selettore CSS o l’elemento DOM del contenitore. ```html
``` ```javascript const paymentElement = checkout.createPaymentElement(); paymentElement.mount('#payment-element'); ``` Consulta la [documentazione Stripe.js](https://docs.stripe.com/js/custom_checkout/create_payment_element#custom_checkout_create_payment_element-options) per visualizzare le opzioni supportate. Puoi [personalizzare l’aspetto](https://docs.stripe.com/payments/checkout/customization/appearance.md) di tutti gli elementi specificando [elementsOptions.appearance](https://docs.stripe.com/js/custom_checkout/init#custom_checkout_init-options-elementsOptions-appearance) durante l’inizializzazione di Checkout nel front-end. #### React Monta il componente [Payment Element](https://docs.stripe.com/payments/payment-element.md) all’interno del [CheckoutElementsProvider](https://docs.stripe.com/js/react_stripe_js/checkout/checkout_provider). ```jsx import React from 'react';import {PaymentElement, useCheckoutElements} from '@stripe/react-stripe-js/checkout'; const CheckoutForm = () => { const checkoutState = useCheckoutElements(); if (checkoutState.type === 'loading') { return (
Loading...
); } if (checkoutState.type === 'error') { return (
Error: {checkoutState.error.message}
); } return (
{JSON.stringify(checkoutState.checkout.lineItems, null, 2)} {/* A formatted total amount */} Total: {checkoutState.checkout.total.total.amount} ); }; export default CheckoutForm; ``` Consulta la [documentazione Stripe.js](https://docs.stripe.com/js/custom_checkout/create_payment_element#custom_checkout_create_payment_element-options) per visualizzare le opzioni supportate. Puoi [personalizzare l’aspetto](https://docs.stripe.com/payments/checkout/customization/appearance.md) di tutti gli Elements specificando [elementsOptions.appearance](https://docs.stripe.com/js/react_stripe_js/checkout/checkout_provider#react_checkout_provider-options-elementsOptions-appearance) in [CheckoutElementsProvider](https://docs.stripe.com/js/react_stripe_js/checkout/checkout_provider). ## Submit the payment [Lato client] #### HTML + JS Visualizza un pulsante **Paga** che le chiamate [confermano](https://docs.stripe.com/js/custom_checkout/confirm) dall’istanza di `Checkout` per inviare il pagamento. ```html
``` ```js const checkout = stripe.initCheckoutElementsSdk({clientSecret}); checkout.on('change', (session) => { document.getElementById('pay-button').disabled = !session.canConfirm; }); const loadActionsResult = await checkout.loadActions(); if (loadActionsResult.type === 'success') { const {actions} = loadActionsResult; const button = document.getElementById('pay-button'); const errors = document.getElementById('confirm-errors'); button.addEventListener('click', () => { // Clear any validation errors errors.textContent = ''; actions.confirm().then((result) => { if (result.type === 'error') { errors.textContent = result.error.message; } }); }); } ``` #### React Visualizza un pulsante **Paga** che richiama [conferma](https://docs.stripe.com/js/custom_checkout/confirm) da [useCheckoutElements](https://docs.stripe.com/js/react_stripe_js/checkout/use_checkout_elements) per inviare il pagamento. ```jsx import React from 'react'; import {useCheckoutElements} from '@stripe/react-stripe-js/checkout'; const PayButton = () => { const checkoutState = useCheckoutElements(); const [loading, setLoading] = React.useState(false); const [error, setError] = React.useState(null); if (checkoutState.type !== "success") { return null; } const handleClick = () => { setLoading(true);checkoutState.checkout.confirm().then((result) => { if (result.type === 'error') { setError(result.error) } setLoading(false); }) }; return (
{error &&
{error.message}
}
) }; export default PayButton; ``` ## Test your integration You can test your form using the test BSB number `000000` and one of the test account numbers below when going through your checkout flow, or use the corresponding token to skip manually entering bank account details. | Numero BSB | Numero di conto | Token | Descrizione | | ---------- | --------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `000000` | `000123456` | `pm_auBecsDebit_success` | Lo stato del PaymentIntent passa da `processing` a `succeeded`. Lo stato del mandato rimane `active`. | | `000000` | `900123456` | `pm_auBecsDebit_successDelayed` | Lo stato del PaymentIntent passa da `processing` a `succeeded` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `111111113` | `pm_auBecsDebit_accountClosed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `account_closed`. Lo stato del mandato diventa `inactive`. | | `000000` | `111111116` | `pm_auBecsDebit_noAccount` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `no_account`. Lo stato del mandato diventa `inactive`. | | `000000` | `222222227` | `pm_auBecsDebit_referToCustomer` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer`. Lo stato del mandato rimane `active`. | | `000000` | `922222227` | `pm_auBecsDebit_referToCustomerDelayed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `333333335` | `pm_auBecsDebit_debitNotAuthorized` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `debit_not_authorized`. Lo stato del mandato diventa `inactive`. | | `000000` | `666666660` | `pm_auBecsDebit_dispute` | Lo stato di PaymentIntent passa da `processing` a `succeeded`, ma viene creata immediatamente una contestazione. | | `000000` | `343434343` | `pm_auBecsDebit_exceedsWeeklyLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_source_limit` dovuto all’importo del pagamento che ha causato il superamento del limite del volume di pagamento settimanale. | | `000000` | `121212121` | `pm_auBecsDebit_exceedsTransactionLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_transaction_limit` a causa dell’importo del pagamento che supera il limite del volume delle transazioni dell’account. | Using test account numbers triggers *webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) events. In a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes), Checkout Sessions complete immediately, and as a result, the respective `checkout.session.completed` and `checkout.session.async_payment_failed` events trigger immediately as well. In live mode, the webhooks get triggered with the same delays as those of their related Checkout Session successes and failures. ## Optional: Configure customer debit date You can control the date that Stripe debits a customer’s bank account using the [target date](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-payment_method_options-au_becs_debit-target_date). The target date must be at least three days in the future and no more than 15 days from the current date. The target date schedules money to leave the customer’s account on the target date. Target dates that meet one of the following criteria delay the debit until the next available business day: - Target date falls on a weekend, a bank holiday, or other non-business day. - Target date is fewer than three business days in the future. This parameter operates on a best-effort basis. Each customer’s bank might process debits on different dates, depending on local bank holidays or other reasons. # iOS > This is a iOS for when payment-ui is mobile and platform is ios. View the full page at https://docs.stripe.com/payments/au-becs-debit/accept-a-payment?payment-ui=mobile&platform=ios. > Se non devi eseguire la conferma manuale lato server o la tua integrazione non richiede la presentazione di metodi di pagamento in modo distinto, ti consigliamo di seguire le istruzioni della guida [Accettare un pagamento](https://docs.stripe.com/payments/accept-a-payment.md). Se hai già effettuato l’integrazione con Elements, consulta la [guida alla migrazione a Payment Element](https://docs.stripe.com/payments/payment-element/migration.md). Check out the [BECS Direct Debit sample](https://docs.stripe.com/payments/au-becs-debit.md#payment-flow) or see the [code on GitHub](https://github.com/stripe-samples/au-becs-debit-payment). Use [STPAUBECSFormView](https://stripe.dev/stripe-ios/stripe-payments-ui/Classes/STPAUBECSDebitFormView.html), Stripe’s prebuilt BECS payment details collection UI, to create a payment form that securely collects bank details without handling sensitive customer data. Accepting BECS Direct Debit payments in your app consists of: - Creating an object to track a payment - ​​Collecting payment method information and mandate acknowledgement - Submitting the payment to Stripe for processing Stripe users in Australia can use the [STPAUBECSFormView](https://stripe.dev/stripe-ios/stripe-payments-ui/Classes/STPAUBECSDebitFormView.html) and a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) to accept BECS Direct Debit payments from customers with an Australian bank account. ## Configura Stripe [Lato server] [Lato client] Innanzitutto, devi creare un account Stripe. [Registrati ora](https://dashboard.stripe.com/register). ### Lato server Per questa integrazione sono necessari endpoint sul server che comunicano con l’API Stripe. Utilizza le nostre librerie ufficiali per accedere all’API Stripe dal tuo server: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### Lato client L’[SDK per iOS di Stripe](https://github.com/stripe/stripe-ios) è open source, [completamente documentato](https://stripe.dev/stripe-ios/index.html) e compatibile con le app che supportano iOS 13 o versioni successive. #### Swift Package Manager Per installare l’SDK, segui questi passaggi: 1. In Xcode, seleziona **File** > **Aggiungi dipendenze pacchetto…** e inserisci `https://github.com/stripe/stripe-ios-spm` come URL repository. 1. Seleziona il numero dell’ultima versione dalla nostra [pagina delle release](https://github.com/stripe/stripe-ios/releases). 1. Aggiungi il prodotto **StripePaymentsUI** al [target della tua app](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app). #### CocoaPods 1. Se non l’hai ancora fatto, installa la versione più recente di [CocoaPods](https://guides.cocoapods.org/using/getting-started.html). 1. Se non hai un [Podfile](https://guides.cocoapods.org/syntax/podfile.html), esegui il seguente comando per crearne uno: ```bash pod init ``` 1. Aggiungi questa riga al tuo `Podfile`: ```podfile pod 'StripePaymentsUI' ``` 1. Esegui il seguente comando: ```bash pod install ``` 1. Ricordati di utilizzare d’ora in poi il file `.xcworkspace` per aprire il progetto in Xcode, anziché il file `.xcodeproj` file. 1. In futuro, per eseguire l’aggiornamento alla versione più recente dell’SDK, esegui questo comando: ```bash pod update StripePaymentsUI ``` #### Carthage 1. Se non l’hai ancora fatto, installa la versione più recente di [Carthage](https://github.com/Carthage/Carthage#installing-carthage). 1. Aggiungi questa riga al tuo `Cartfile`: ```cartfile github "stripe/stripe-ios" ``` 1. Segui le [istruzioni per l’installazione di Carthage](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). Assicurati di integrare tutti i framework necessari elencati [qui](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking). 1. In futuro, per eseguire l’aggiornamento alla versione più recente del nostro SDK, esegui il seguente comando: ```bash carthage update stripe-ios --platform ios ``` #### Framework manuale 1. Vai alla [pagina delle versioni di GitHub](https://github.com/stripe/stripe-ios/releases/latest) e scarica e decomprimi **Stripe.xcframework.zip**. 1. Trascina **StripePaymentsUI.xcframework** nella sezione **Embedded Binaries** (File binari incorporati) delle impostazioni **General** (Generali) nel tuo progetto Xcode. Assicurati che sia selezionato **Copy items if needed** (Copia elementi se necessario). 1. Ripeti il passaggio 2 per tutti i framework necessari elencati [qui](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking). 1. In futuro, per eseguire l’aggiornamento alla versione più recente del nostro SDK, ripeti i passaggi 1-3. > Per ulteriori informazioni sulla versione più recente e su quelle precedenti dell’SDK, consulta la pagina [Versioni](https://github.com/stripe/stripe-ios/releases) su GitHub. Per ricevere notifiche quando viene pubblicata una nuova versione, [guarda le versioni](https://help.github.com/en/articles/watching-and-unwatching-releases-for-a-repository#watching-releases-for-a-repository) del repository. Configura l’SDK con la tua [chiave pubblicabile](https://dashboard.stripe.com/test/apikeys) di Stripe all’avvio dell’app. In questo modo l’app può inviare le richieste all’API Stripe. #### Swift ```swift import UIKitimportStripePaymentsUI @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {StripeAPI.defaultPublishableKey = "<>" // do any other necessary launch configuration return true } } ``` > Usa le [chiavi di test](https://docs.stripe.com/keys.md#obtain-api-keys) durante i test e le chiavi della [modalità live](https://docs.stripe.com/keys.md#test-live-modes) quando pubblichi l’app. ## Collect payment method details and mandate acknowledgment [Lato client] You can securely collect BECS Debit payment information with [STPAUBECSFormView](https://stripe.dev/stripe-ios/stripe-payments-ui/Classes/STPAUBECSDebitFormView.html), a drop-in UI component provided by the SDK. `STPAUBECSFormView​` provides a UI for customers to enter their name, email, BSB number, and account number—in addition to displaying the [BECS Direct Debit Terms](https://stripe.com/au-becs/legal). Create an instance of `STPAUBECSFormView​` configured with your company name and set up a delegate for the SDK to notify after the customer enters the required details to create an instance of `STPPaymentMethodParams`​. You can also customize `STPAUBECSFormView​` to match the look and feel of your app by providing values to `STPAUBECSFormView​'s` public properties. #### Swift ```swift import UIKit import StripePaymentsUI class CheckoutViewController: UIViewController { private var becsFormView = STPAUBECSDebitFormView(companyName: "Example Company Inc.") private let payButton = UIButton() private var paymentIntentClientSecret: String? override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .secondarySystemBackground payButton.layer.cornerRadius = 5 payButton.contentEdgeInsets = UIEdgeInsets(top: 4, left: 8, bottom: 4, right: 8) payButton.backgroundColor = .systemGray3 payButton.titleLabel?.font = UIFont.systemFont(ofSize: 18) payButton.setTitle("Accept Mandate and Pay", for: .normal) payButton.addTarget(self, action: #selector(pay), for: .touchUpInside) payButton.isEnabled = false payButton.translatesAutoresizingMaskIntoConstraints = false view.addSubview(payButton) becsFormView.becsDebitFormDelegate = self becsFormView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(becsFormView) NSLayoutConstraint.activate([ becsFormView.leadingAnchor.constraint(equalTo: view.leadingAnchor), view.trailingAnchor.constraint(equalTo: becsFormView.trailingAnchor), becsFormView.topAnchor.constraint(equalToSystemSpacingBelow: view.safeAreaLayoutGuide.topAnchor, multiplier: 2), payButton.centerXAnchor.constraint(equalTo: view.centerXAnchor), payButton.topAnchor.constraint(equalToSystemSpacingBelow: becsFormView.bottomAnchor, multiplier: 2), ]) } @objc func pay() { // ... } } extension CheckoutViewController: STPAUBECSDebitFormViewDelegate { func auBECSDebitForm(_ form: STPAUBECSDebitFormView, didChangeToStateComplete complete: Bool) { payButton.isEnabled = complete payButton.backgroundColor = complete ? .systemBlue : .systemGray3 } } ``` ## Creare un PaymentIntent [Lato server] A [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) is an object that represents your intent to collect a payment. The `PaymentIntent` tracks the lifecycle of the payment process through [each stage](https://docs.stripe.com/payments/paymentintents/lifecycle.md). First, create a PaymentIntent on your server and specify the amount to collect and the `aud` currency (BECS Direct Debit doesn’t support other currencies). If you already have an integration using the [Payment Intents API](https://docs.stripe.com/payments/payment-intents.md), add `au_becs_debit` to the list of [payment method types](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_types) for your `PaymentIntent`. To save the BECS Direct Debit account for reuse, set the [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage) parameter to `off_session`. BECS Direct Debit only accepts an `off_session` value for this parameter. #### Accounts v2 #### curl ```bash curl https://api.stripe.com/v1/payment_intents \ -u <>: \ -d "amount"=1099 \ -d "setup_future_usage"="off_session" \ -d "currency"="aud" \ -d "customer_account"="{{CUSTOMER_ACCOUNT_ID}}" \ -d "payment_method_types[]"="au_becs_debit" ``` #### Customers v1 #### curl ```bash curl https://api.stripe.com/v1/payment_intents \ -u <>: \ -d "amount"=1099 \ -d "setup_future_usage"="off_session" \ -d "currency"="aud" \ -d "customer"="{{CUSTOMER_ID}}" \ -d "payment_method_types[]"="au_becs_debit" ``` When you create a `PaymentIntent`, Stripe generates its [client secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret) property. Pass the client secret to the client side. > Use the client secret to charge the customer the amount specified on the PaymentIntent. Don’t log it, embed it in URLs, or expose it to anyone other than your customer. ## Inviare il pagamento a Stripe [Lato client] When the customer taps the Pay button, confirm the `PaymentIntent` to complete the payment. First, assemble a [STPPaymentIntentParams](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentIntentParams.html) object with: 1. The [STPAUBECSFormView’s](https://stripe.dev/stripe-ios/stripe-payments-ui/Classes/STPAUBECSDebitFormView.html) `paymentMethodParams` property 1. La chiave privata client del `PaymentIntent` del tuo server Rather than sending the entire `PaymentIntent` object to the client, use its [client secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret) from [step 3](https://docs.stripe.com/payments/au-becs-debit/accept-a-payment.md#ios-create-payment-intent). This is different from your API keys that authenticate Stripe API requests. Next, complete the payment by calling the [STPPaymentHandler confirmPayment](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentHandler.html#/c:@M@StripePayments@objc\(cs\)STPPaymentHandler\(im\)confirmPayment:withAuthenticationContext:completion:) method. #### Swift ```swift import UIKit import StripePaymentsUI class CheckoutViewController: UIViewController { // ... @objc func pay() { guard let paymentIntentClientSecret = paymentIntentClientSecret, let paymentMethodParams = becsFormView.paymentMethodParams else { return; } let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) paymentIntentParams.paymentMethodParams = paymentMethodParams STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self) { (handlerStatus, paymentIntent, error) in switch handlerStatus { case .succeeded: // Payment succeeded // ... case .canceled: // Payment canceled // ... case .failed: // Payment failed // ... @unknown default: fatalError() } } } } extension CheckoutViewController: STPAuthenticationContext { func authenticationPresentingViewController() -> UIViewController { return self } } ``` After confirming the `PaymentIntent​`, share the [mandate URL](https://docs.stripe.com/api/mandates/object.md#mandate_object-payment_method_details-au_becs_debit-url) from the [Mandate object](https://docs.stripe.com/api/mandates.md) with your customer. We also recommend including the following details when you confirm their mandate has been established: - An explicit confirmation message that indicates a Direct Debit arrangement has been set up - The business name that will appear on the customer’s bank statement whenever their account gets debited - The payment amount and schedule (if applicable) - A link to the generated DDR mandate URL You can access the `Mandate​` object’s ID from `the payment_method_details​` on the [latest_charge](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-latest_charge) of the `PaymentIntent` by [retrieving it](https://docs.stripe.com/api/payment_intents/retrieve.md). Utenti con versione API [2022-08-01](https://docs.stripe.com/upgrades.md#2022-08-01) o precedente: ​​You can access the `Mandate​` object’s ID from `the payment_method_details​` on the [charge object](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-charges-data) of the `PaymentIntent` (included with the `payment_intent.processing​` event sent after confirmation) or [retrieve it](https://docs.stripe.com/api/payment_intents/retrieve.md). ## Confermare la riuscita del PaymentIntent [Lato server] BECS Direct Debit is a [delayed notification](https://docs.stripe.com/payments/payment-methods.md#payment-notification) payment method, which means that funds aren’t immediately available. A BECS Direct Debit PaymentIntent typically remains in a processing state for 2 business days after submission to the BECS network. This submission happens once per day. Once the payment succeeds, the associated `PaymentIntent` status updates from `processing` to `succeeded`. The following events are sent when the `PaymentIntent` status is updated: | Evento | Description | Passaggi successivi | | ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | | `payment_intent.processing` | The customer’s payment was submitted to Stripe successfully. | Attendi che il pagamento avviato vada o meno a buon fine | | `payment_intent.succeeded` | Il pagamento del cliente è andato a buon fine. | Fulfill the goods or services that were purchased. | | `payment_intent.payment_failed` | The customer’s payment was declined. | Contact the customer through email or push notification and request another payment method. | Because [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage) and [customer](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-customer) were set, the *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) will be attached to the *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) object when the payment enters the `processing` state. This attachment happens regardless of whether payment eventually succeeds or fails. When a Direct Debit attempt fails, Stripe sends a `payment_intent.payment_failed` event containing a `PaymentIntent` object. The `last_payment_error` attribute on the `PaymentIntent` contains a `code` and `message` describing details of the failure. The failures can be transient or final for the mandate associated with the failed `PaymentIntent`. In case of a final failure, Stripe revokes the mandate to prevent additional failure costs. When this happens, and you need your customer to pay, it’s your responsibility to contact your customer to establish a new mandate by [re-collecting the bank account information](https://docs.stripe.com/payments/au-becs-debit/set-up-payment.md). For the following failure codes returned, Stripe updates the mandate status as follows: | Failure Code | Description | Mandate Status | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------- | | `debit_not_authorized` | There’s a permanent failure due to a restriction or block to debit the account and you should contact your customer. | `inactive` | | `account_closed` | There’s a permanent failure because the account has been closed and you should contact your customer. | `inactive` | | `no_account` | There’s a permanent failure because there’s no account for the provided bank information and you should contact your customer. | `inactive` | | `refer_to_customer` | There’s a transient failure (for example, insufficient funds) and you can re-attempt to debit without collecting a new mandate. | `active` | We recommend [using webhooks](https://docs.stripe.com/payments/payment-intents/verifying-status.md#webhooks) to confirm the charge succeeds or fails, and to notify the customer whether mandate establishment and payment are complete or if they require additional attention. ## Testare l'integrazione You can test your form using the test BSB number `000000` and one of the test account numbers below with your [STPPaymentHandler confirmPayment](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentHandler.html#/c:@M@StripePayments@objc\(cs\)STPPaymentHandler\(im\)confirmPayment:withAuthenticationContext:completion:) method call. | Numero BSB | Numero di conto | Token | Descrizione | | ---------- | --------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `000000` | `000123456` | `pm_auBecsDebit_success` | Lo stato del PaymentIntent passa da `processing` a `succeeded`. Lo stato del mandato rimane `active`. | | `000000` | `900123456` | `pm_auBecsDebit_successDelayed` | Lo stato del PaymentIntent passa da `processing` a `succeeded` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `111111113` | `pm_auBecsDebit_accountClosed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `account_closed`. Lo stato del mandato diventa `inactive`. | | `000000` | `111111116` | `pm_auBecsDebit_noAccount` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `no_account`. Lo stato del mandato diventa `inactive`. | | `000000` | `222222227` | `pm_auBecsDebit_referToCustomer` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer`. Lo stato del mandato rimane `active`. | | `000000` | `922222227` | `pm_auBecsDebit_referToCustomerDelayed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `333333335` | `pm_auBecsDebit_debitNotAuthorized` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `debit_not_authorized`. Lo stato del mandato diventa `inactive`. | | `000000` | `666666660` | `pm_auBecsDebit_dispute` | Lo stato di PaymentIntent passa da `processing` a `succeeded`, ma viene creata immediatamente una contestazione. | | `000000` | `343434343` | `pm_auBecsDebit_exceedsWeeklyLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_source_limit` dovuto all’importo del pagamento che ha causato il superamento del limite del volume di pagamento settimanale. | | `000000` | `121212121` | `pm_auBecsDebit_exceedsTransactionLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_transaction_limit` a causa dell’importo del pagamento che supera il limite del volume delle transazioni dell’account. | *Webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) events are triggered when using test account numbers. In a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes), PaymentIntents succeed and fail immediately, and as a result, the respective `payment_intent.succeeded` and `payment_intent.payment_failed` events trigger immediately as well. In live mode, the webhooks get triggered with the same delays as those of their related PaymentIntent successes and failures. ## See also - [Save Australia BECS Direct Debit details for future payments](https://docs.stripe.com/payments/au-becs-debit/set-up-payment.md) - [Connect payments](https://docs.stripe.com/connect/charges.md) # Android > This is a Android for when payment-ui is mobile and platform is android. View the full page at https://docs.stripe.com/payments/au-becs-debit/accept-a-payment?payment-ui=mobile&platform=android. > Se non devi eseguire la conferma manuale lato server o la tua integrazione non richiede la presentazione di metodi di pagamento in modo distinto, ti consigliamo di seguire le istruzioni della guida [Accettare un pagamento](https://docs.stripe.com/payments/accept-a-payment.md). Se hai già effettuato l’integrazione con Elements, consulta la [guida alla migrazione a Payment Element](https://docs.stripe.com/payments/payment-element/migration.md). Check out the [BECS Direct Debit sample](https://docs.stripe.com/payments/au-becs-debit.md#payment-flow) or see the [code on GitHub](https://github.com/stripe-samples/au-becs-debit-payment). Use [BecsDebitWidget](https://stripe.dev/stripe-android/payments-core/com.stripe.android.view/-becs-debit-widget/index.html), Stripe’s prebuilt BECS payment details collection UI, to create a payment form that securely collects bank details without handling sensitive customer data. Accepting BECS Direct Debit payments in your app consists of: - Creating an object to track a payment - ​​Collecting payment method information and mandate acknowledgement - Submitting the payment to Stripe for processing Stripe users in Australia can use the [BecsDebitWidget](https://stripe.dev/stripe-android/payments-core/com.stripe.android.view/-becs-debit-widget/index.html) and a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) to accept BECS Direct Debit payments from customers with an Australian bank account. ## Configura Stripe [Lato server] [Lato client] Innanzitutto, devi creare un account Stripe. [Registrati ora](https://dashboard.stripe.com/register). ### Lato server Per questa integrazione sono necessari endpoint sul server che comunicano con l’API Stripe. Utilizza le nostre librerie ufficiali per accedere all’API Stripe dal tuo server: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### Lato client L’[SDK per Android di Stripe](https://github.com/stripe/stripe-android) è open source e [completamente documentato](https://stripe.dev/stripe-android/). Per installare l’SDK, aggiungi `stripe-android` al blocco `dependencies` del tuo file [app/build.gradle](https://developer.android.com/studio/build/dependencies): #### Kotlin ```kotlin plugins { id("com.android.application") } android { ... } dependencies { // ... // Stripe Android SDK implementation("com.stripe:stripe-android:23.8.0") // Include the financial connections SDK to support US bank account as a payment method implementation("com.stripe:financial-connections:23.8.0") } ``` > Per ulteriori informazioni sulla versione più recente e su quelle precedenti dell’SDK, consulta la pagina [Releases](https://github.com/stripe/stripe-android/releases) su GitHub. Per ricevere una notifica quando viene pubblicata una nuova versione, [imposta il controllo delle versioni per il repository](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository). Configura l’SDK con la tua [chiave pubblicabile](https://dashboard.stripe.com/apikeys) di Stripe in modo che possa inviare le richieste all’API Stripe, ad esempio nella sottoclasse `Application`: #### Kotlin ```kotlin import com.stripe.android.PaymentConfiguration class MyApp : Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext, "<>" ) } } ``` > Usa le [chiavi di test](https://docs.stripe.com/keys.md#obtain-api-keys) durante i test e le chiavi della [modalità live](https://docs.stripe.com/keys.md#test-live-modes) quando pubblichi l’app. I nostri esempi di codice Stripe utilizzano inoltre [OkHttp](https://github.com/square/okhttp) e [GSON](https://github.com/google/gson) per inviare richieste HTTP a un server. ## Collect payment method details and mandate acknowledgment [Lato client] You can securely collect BECS Debit payment information with [BecsDebitWidget](https://stripe.dev/stripe-android/payments-core/com.stripe.android.view/-becs-debit-widget/index.html), a drop-in UI component provided by the SDK. `BecsDebitWidget` provides a UI for customers to enter their name, email, BSB number, and account number. It also displays the [BECS Direct Debit Terms](https://stripe.com/au-becs/legal). ### Add BecsDebitWidget to your layout Add `BecsDebitWidget` to your layout and configure the `app:companyName` attribute with your company name. ```xml
``` #### Controllare i metodi di pagamento dalla Dashboard Una volta caricato il modulo sopra menzionato, crea un’istanza di Elements con i parametri `mode`, `amount` e `currency`. Questi valori determinano i metodi di pagamento visualizzati dal cliente. Per specificare un nuovo metodo di pagamento nel tuo modulo, assicurati di abilitarlo nella [Dashboard](https://dashboard.stripe.com/settings/payment_methods). ```javascript const options = {mode:'payment', amount:1099, currency: 'aud', // Fully customizable with appearance API. appearance: {/*...*/}, }; // Set up Stripe.js and Elements to use in checkout formconst elements = stripe.elements(options); // Create and mount the Payment Element const paymentElementOptions = { layout: 'accordion'}; const paymentElement = elements.create('payment', paymentElementOptions); paymentElement.mount('#payment-element'); ``` #### Elencare manualmente i metodi di pagamento Per elencare manualmente i metodi di pagamento che desideri siano disponibili, aggiungili a`paymentMethodTypes`. Quindi crea un’istanza di Payment Element e integrala nel nodo DOM del contenitore. ```javascript const options = {mode:'payment', amount:1099, currency: 'aud', paymentMethodTypes: ['au_becs_debit'], // Fully customizable with appearance API. appearance: {/*...*/}, }; // Set up Stripe.js and Elements to use in checkout formconst elements = stripe.elements(options); // Create and mount the Payment Element const paymentElementOptions = { layout: 'accordion'}; const paymentElement = elements.create('payment', paymentElementOptions); paymentElement.mount('#payment-element'); ``` #### React ### Configurare Stripe. js Installa [React Stripe.js](https://www.npmjs.com/package/@stripe/react-stripe-js) e il [caricatore Stripe.js](https://www.npmjs.com/package/@stripe/stripe-js) dal registro di sistema pubblico npm. ```bash npm install --save @stripe/react-stripe-js @stripe/stripe-js ``` ### Aggiungi e configura il provider Elements alla pagina di pagamento Per utilizzare il componente Payment Element, includi il componente della pagina di pagamento in un [provider Elements](https://docs.stripe.com/sdks/stripejs-react.md#elements-provider). Chiama `loadStripe` con la chiave pubblicabile e fornisci il parametro `Promise` restituito al provider `Elements`. #### Controllare i metodi di pagamento dalla Dashboard Il provider `Elements` accetta anche i parametri `mode`, `amount` e `currency`. Questi valori determinano i metodi di pagamento visualizzati dal cliente. Per specificare un nuovo metodo di pagamento nel tuo modulo, assicurati di abilitarlo nella [Dashboard](https://dashboard.stripe.com/settings/payment_methods). ```jsx import React from 'react'; import ReactDOM from 'react-dom'; import {Elements} from '@stripe/react-stripe-js'; import {loadStripe} from '@stripe/stripe-js'; import CheckoutForm from './CheckoutForm'; // Make sure to call `loadStripe` outside of a component’s render to avoid // recreating the `Stripe` object on every render. const stripePromise = loadStripe('<>'); function App() { const options = {mode:'payment', amount:1099, currency: 'aud', // Fully customizable with appearance API. appearance: {/*...*/}, }; return ( ); }; ReactDOM.render(, document.getElementById('root')); ``` #### Elencare manualmente i metodi di pagamento ```jsx import React from 'react'; import ReactDOM from 'react-dom'; import {Elements} from '@stripe/react-stripe-js'; import {loadStripe} from '@stripe/stripe-js'; import CheckoutForm from './CheckoutForm'; // Make sure to call `loadStripe` outside of a component’s render to avoid // recreating the `Stripe` object on every render. const stripePromise = loadStripe('<>'); function App() { const options = {mode:'payment', amount:1099, currency: 'aud', paymentMethodTypes: ['au_becs_debit'], // Fully customizable with appearance API. appearance: {/*...*/}, }; return ( ); }; ReactDOM.render(, document.getElementById('root')); ``` ### Aggiungere Payment Element Utilizza il componente `PaymentElement` per creare il modulo. ```jsx import React from 'react'; import {PaymentElement} from '@stripe/react-stripe-js'; const CheckoutForm = () => { return (
); }; export default CheckoutForm; ``` Puoi personalizzare il componente Payment Element perché si accordi al design del tuo sito specificando l’[oggetto appearance](https://docs.stripe.com/elements/appearance-api.md) in `options` al momento della creazione del provider `Elements`. ### Raccogli indirizzi By default, the Payment Element only collects the necessary billing address details. Some behavior, such as [calculating tax](https://docs.stripe.com/api/tax/calculations/create.md) or entering shipping details, requires your customer’s full address. You can: - Utilizza [Address Element](https://docs.stripe.com/elements/address-element.md) per sfruttare le funzioni di completamento automatico e localizzazione per raccogliere l’indirizzo completo dei tuoi clienti. Ciò contribuisce a garantire il calcolo più accurato delle imposte. - Raccogli i dettagli dell’indirizzo utilizzando il tuo modulo personalizzato. ## Creare un PaymentIntent [Lato server] > #### Eseguire la logica aziendale personalizzata immediatamente prima della conferma del pagamento > > Vai alla [fase 5](https://docs.stripe.com/payments/finalize-payments-on-the-server.md?platform=web&type=payment#submit-payment) della guida ai pagamenti per eseguire la tua logica aziendale personalizzata immediatamente prima della conferma del pagamento. Altrimenti, segui i passaggi riportati di seguito per un’integrazione più semplice, che utilizza `stripe.confirmPayment` sul client per confermare il pagamento e gestire eventuali azioni successive. #### Controllare i metodi di pagamento dalla Dashboard Quando il cliente invia il modulo di pagamento, utilizza un *PaymentIntent* (The Payment Intents API tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods) per facilitare il processo di conferma e pagamento. Crea sul tuo server un PaymentIntent con i parametri `amount` e `currency` abilitati. Decidi sempre quanto addebitare sul lato server, che è un ambiente sicuro, anziché sul lato client. In questo modo impedisci ai client malintenzionati di scegliere un proprio prezzo. Il `PaymentIntent` include una % glossary term=“payment-intent-secret” %}chiave privata client**. Restituisci questo valore al tuo client affinché Stripe.js lo utilizzi per completare la procedura di pagamento in modo sicuro. #### Account v2 #### Ruby ```ruby require 'stripe' # Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. client = Stripe::StripeClient.new('<>') post '/create-intent' do intent = client.v1.payment_intents.create({ # To allow saving and retrieving payment methods, provide the customer's Account ID. customer_account: "{{CUSTOMER_ACCOUNT_ID}}", amount: 1099, currency: 'aud', setup_future_usage: 'off_session', }) {client_secret: intent.client_secret}.to_json end ``` #### Clienti v1 #### Ruby ```ruby require 'stripe' # Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. client = Stripe::StripeClient.new('<>') post '/create-intent' do intent = client.v1.payment_intents.create({ # To allow saving and retrieving payment methods, provide the Customer ID. customer: customer.id, amount: 1099, currency: 'aud', setup_future_usage: 'off_session', }) {client_secret: intent.client_secret}.to_json end ``` #### Elencare manualmente i metodi di pagamento Quando il cliente invia il modulo di pagamento, utilizza un *PaymentIntent* (The Payment Intents API tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods) per facilitare la procedura di conferma e pagamento. Crea sul tuo server un PaymentIntent con `amount`, `currency` e uno o più metodi di pagamento utilizzando `payment_method_types`. Decidi sempre quanto addebitare sul lato server, che è un ambiente sicuro, anziché sul lato client. In questo modo impedisci ai client malintenzionati di scegliere un proprio prezzo. Il PaymentIntent include una *chiave privata client* (The client secret is a unique key returned from Stripe as part of a PaymentIntent. This key lets the client access important fields from the PaymentIntent (status, amount, currency) while hiding sensitive ones (metadata, customer)). Restituisci questo valore al tuo client affinché Stripe.js lo utilizzi per completare la procedura di pagamento in modo sicuro. #### Account v2 #### Ruby ```ruby require 'stripe' # Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. client = Stripe::StripeClient.new('<>') post '/create-intent' do intent = client.v1.payment_intents.create({ # To allow saving and retrieving payment methods, provide the customer's Account ID. customer_account: customer_account.id, amount: 1099, currency: 'aud', setup_future_usage: 'off_session', payment_method_types: ['au_becs_debit'], }) {client_secret: intent.client_secret}.to_json end ``` #### Clienti v1 #### Ruby ```ruby require 'stripe' # Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. client = Stripe::StripeClient.new('<>') post '/create-intent' do intent = client.v1.payment_intents.create({ # To allow saving and retrieving payment methods, provide the Customer ID. customer: customer.id, amount: 1099, currency: 'aud', setup_future_usage: 'off_session', payment_method_types: ['au_becs_debit'], }) {client_secret: intent.client_secret}.to_json end ``` ## Inviare il pagamento a Stripe [Lato client] Utilizza [stripe.confirmPayment](https://docs.stripe.com/js/payment_intents/confirm_payment) per completare il pagamento utilizzando i dettagli di Payment Element. Fornisci un [return_url](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-return_url) a questa funzione per indicare dove Stripe deve reindirizzare l’utente dopo il completamento del pagamento. L’utente può essere dapprima reindirizzato su un sito intermedio, come una pagina di autorizzazione della banca, prima di essere reindirizzato al `return_url`. In caso di esito positivo, i pagamenti con carta vengono immediatamente reindirizzati al `return_url`. Se vuoi impedire il reindirizzamento per i pagamenti con carta una volta completato il pagamento, puoi impostare il [reindirizzamento](https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent-options-redirect) su `if_required`. In questo modo vengono reindirizzati solo i clienti che utilizzano metodi di pagamento basati sul reindirizzamento. #### HTML + JS ```javascript const form = document.getElementById('payment-form'); const submitBtn = document.getElementById('submit'); const handleError = (error) => { const messageContainer = document.querySelector('#error-message'); messageContainer.textContent = error.message; submitBtn.disabled = false; } form.addEventListener('submit', async (event) => { // We don't want to let default form submission happen here, // which would refresh the page. event.preventDefault(); // Prevent multiple form submissions if (submitBtn.disabled) { return; } // Disable form submission while loading submitBtn.disabled = true; // Trigger form validation and wallet collection const {error: submitError} = await elements.submit(); if (submitError) { handleError(submitError); return; } // Create the PaymentIntent and obtain clientSecret const res = await fetch("/create-intent", { method: "POST", }); const {client_secret: clientSecret} = await res.json(); // Confirm the PaymentIntent using the details collected by the Payment Element const {error} = await stripe.confirmPayment({ elements, clientSecret, confirmParams: { return_url: 'https://example.com/order/123/complete', }, }); if (error) { // This point is only reached if there's an immediate error when // confirming the payment. Show the error to your customer (for example, payment details incomplete) handleError(error); } else { // Your customer is redirected to your `return_url`. For some payment // methods like iDEAL, your customer is redirected to an intermediate // site first to authorize the payment, then redirected to the `return_url`. } }); ``` #### React ```jsx import React, {useState} from 'react'; import {useStripe, useElements, PaymentElement} from '@stripe/react-stripe-js'; export default function CheckoutForm() { const stripe = useStripe(); const elements = useElements(); const [errorMessage, setErrorMessage] = useState(); const [loading, setLoading] = useState(false); const handleError = (error) => { setLoading(false); setErrorMessage(error.message); } const handleSubmit = async (event) => { // We don't want to let default form submission happen here, // which would refresh the page. event.preventDefault(); if (!stripe) { // Stripe.js hasn't yet loaded. // Make sure to disable form submission until Stripe.js has loaded. return; } setLoading(true); // Trigger form validation and wallet collection const {error: submitError} = await elements.submit(); if (submitError) { handleError(submitError); return; } // Create the PaymentIntent and obtain clientSecret const res = await fetch("/create-intent", { method: "POST", }); const {client_secret: clientSecret} = await res.json(); // Confirm the PaymentIntent using the details collected by the Payment Element const {error} = await stripe.confirmPayment({ elements, clientSecret, confirmParams: { return_url: 'https://example.com/order/123/complete', }, }); if (error) { // This point is only reached if there's an immediate error when // confirming the payment. Show the error to your customer (for example, payment details incomplete) handleError(error); } else { // Your customer is redirected to your `return_url`. For some payment // methods like iDEAL, your customer is redirected to an intermediate // site first to authorize the payment, then redirected to the `return_url`. } }; return (
{errorMessage &&
{errorMessage}
} ); } ``` ## Confermare la riuscita del PaymentIntent [Lato server] BECS Direct Debit is a [delayed notification](https://docs.stripe.com/payments/payment-methods.md#payment-notification) payment method, which means that funds aren’t immediately available. A BECS Direct Debit PaymentIntent typically remains in a processing state for 2 business days after submission to the BECS network. This submission happens once per day. Once the payment succeeds, the associated `PaymentIntent` status updates from `processing` to `succeeded`. The following events are sent when the `PaymentIntent` status is updated: | Evento | Description | Passaggi successivi | | ------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | | `payment_intent.processing` | The customer’s payment was submitted to Stripe successfully. | Attendi che il pagamento avviato vada o meno a buon fine | | `payment_intent.succeeded` | Il pagamento del cliente è andato a buon fine. | Fulfill the goods or services that were purchased. | | `payment_intent.payment_failed` | The customer’s payment was declined. | Contact the customer through email or push notification and request another payment method. | Because [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage) and [customer](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-customer) were set, the *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) will be attached to the *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) object when the payment enters the `processing` state. This attachment happens regardless of whether payment eventually succeeds or fails. When a Direct Debit attempt fails, Stripe sends a `payment_intent.payment_failed` event containing a `PaymentIntent` object. The `last_payment_error` attribute on the `PaymentIntent` contains a `code` and `message` describing details of the failure. The failures can be transient or final for the mandate associated with the failed `PaymentIntent`. In case of a final failure, Stripe revokes the mandate to prevent additional failure costs. When this happens, and you need your customer to pay, it’s your responsibility to contact your customer to establish a new mandate by [re-collecting the bank account information](https://docs.stripe.com/payments/au-becs-debit/set-up-payment.md). For the following failure codes returned, Stripe updates the mandate status as follows: | Failure Code | Description | Mandate Status | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------- | | `debit_not_authorized` | There’s a permanent failure due to a restriction or block to debit the account and you should contact your customer. | `inactive` | | `account_closed` | There’s a permanent failure because the account has been closed and you should contact your customer. | `inactive` | | `no_account` | There’s a permanent failure because there’s no account for the provided bank information and you should contact your customer. | `inactive` | | `refer_to_customer` | There’s a transient failure (for example, insufficient funds) and you can re-attempt to debit without collecting a new mandate. | `active` | We recommend [using webhooks](https://docs.stripe.com/payments/payment-intents/verifying-status.md#webhooks) to confirm the charge succeeds or fails, and to notify the customer whether mandate establishment and payment are complete or if they require additional attention. ## Test your integration You can test your form using the test BSB number `000000` and one of the test account numbers below when going through your checkout flow, or use the corresponding token to skip manually entering bank account details. | Numero BSB | Numero di conto | Token | Descrizione | | ---------- | --------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `000000` | `000123456` | `pm_auBecsDebit_success` | Lo stato del PaymentIntent passa da `processing` a `succeeded`. Lo stato del mandato rimane `active`. | | `000000` | `900123456` | `pm_auBecsDebit_successDelayed` | Lo stato del PaymentIntent passa da `processing` a `succeeded` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `111111113` | `pm_auBecsDebit_accountClosed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `account_closed`. Lo stato del mandato diventa `inactive`. | | `000000` | `111111116` | `pm_auBecsDebit_noAccount` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `no_account`. Lo stato del mandato diventa `inactive`. | | `000000` | `222222227` | `pm_auBecsDebit_referToCustomer` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer`. Lo stato del mandato rimane `active`. | | `000000` | `922222227` | `pm_auBecsDebit_referToCustomerDelayed` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `refer_to_customer` (con un ritardo di tre minuti). Lo stato del mandato rimane `active`. | | `000000` | `333333335` | `pm_auBecsDebit_debitNotAuthorized` | Lo stato del PaymentIntent passa da `processing` a `requires_payment_method` con un codice di errore `debit_not_authorized`. Lo stato del mandato diventa `inactive`. | | `000000` | `666666660` | `pm_auBecsDebit_dispute` | Lo stato di PaymentIntent passa da `processing` a `succeeded`, ma viene creata immediatamente una contestazione. | | `000000` | `343434343` | `pm_auBecsDebit_exceedsWeeklyLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_source_limit` dovuto all’importo del pagamento che ha causato il superamento del limite del volume di pagamento settimanale. | | `000000` | `121212121` | `pm_auBecsDebit_exceedsTransactionLimit` | Il PaymentIntent non va a buon fine con un errore `charge_exceeds_transaction_limit` a causa dell’importo del pagamento che supera il limite del volume delle transazioni dell’account. | Using test account numbers triggers *webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) events. In a *sandbox* (A sandbox is an isolated test environment that allows you to test Stripe functionality in your account without affecting your live integration. Use sandboxes to safely experiment with new features and changes), PaymentIntents succeed and fail immediately, and as a result, the respective `payment_intent.succeeded` and `payment_intent.payment_failed` events trigger immediately as well. In live mode, the webhooks get triggered with the same delays as those of their related PaymentIntent successes and failures. ## Optional: Configure customer debit date You can control the date that Stripe debits a customer’s bank account using the [target date](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-payment_method_options-au_becs_debit-target_date). The target date must be at least three days in the future and no more than 15 days from the current date. The target date schedules money to leave the customer’s account on the target date. You can [cancel a PaymentIntent](https://docs.stripe.com/api/payment_intents/cancel.md) created with a target date up to three business days before the configured date. Target dates that meet one of the following criteria delay the debit until next available business day: - Target date falls on a weekend, a bank holiday, or other non-business day. - Target date is fewer than three business days in the future. This parameter operates on a best-effort basis. Each customer’s bank might process debits on different dates, depending on local bank holidays or other reasons. ## See also - [Save Australia BECS Direct Debit details for future payments](https://docs.stripe.com/payments/au-becs-debit/set-up-payment.md) - [Connect payments](https://docs.stripe.com/connect/charges.md)