Skip to content
Create account or Sign in
The Stripe Docs logo
/
Ask AI
Create accountSign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
APIs & SDKsHelp

PayTo payments

Learn how to accept the PayTo payment method.

PayTo is a real-time payment method in Australia for accepting one-time and recurring payments. When paying with PayTo, customers authenticate and approve mandates using their mobile banking app or online banking.

You get delayed notification on whether the payment succeeded or failed. Stripe typically sends a notification of the final status of the payment within 60 seconds of the mandate authorisation.

Set up Stripe
Server-side

First, you need a Stripe account. Register now.

To access the Stripe API from your application, use our official libraries:

Command Line
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# Available as a gem sudo gem install stripe
Gemfile
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Create a PaymentIntent
Server-side

A PaymentIntent is an object that represents your intent to collect a payment from a customer and tracks the payment process. To create a PaymentIntent that accepts a PayTo payment method, specify the amount to collect, aud as the currency, and payto in the payment_method_types list. If you maintain a list of payment method types that you pass when creating a PaymentIntent, add payto to it.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=1000 \ -d currency=aud \ -d "payment_method_types[]"=payto

Retrieve the client secret

The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.

Retrieve the client secret from an endpoint on your server, using the browser’s fetch function. This approach is best if your client side is a single-page application, particularly one built with a modern front-end framework such as React. Create the server endpoint that serves the client secret:

main.rb
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
get '/secret' do intent = # ... Create or retrieve the PaymentIntent {client_secret: intent.client_secret}.to_json end

And then fetch the client secret with JavaScript on the client side:

(async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })();

Collect payment method details and submit the payment
Client-side

When you confirm the payment, pass the client secret.

Caution

Handle the client secret carefully, because it allows access to the PaymentIntent. Don’t log it, embed it in URLs, or expose it to anyone but the customer.

Use stripe.confirmPayToPayment to initiate the payment authorisation with your customer.

The customer receives a notification about the payment request, and authorises or declines the request in their banking app.

script.js
// Inititates the payment request notification to the customer stripe.confirmPayToPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { // Name is required for all PayTo payments name: 'Jenny Rosen', // Email is required only for PayID payments, for refund processing email: 'jenny@example.com' }, payto: { // Either provide a PayID (typically an email or phone number) pay_id: 'jenny@example.com' // ...or provide bank account details account_number: '000123456', bsb_number: '000000' } } } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } });

By default, Stripe.js polls for updates to the PaymentIntent. The promise returned by confirmPayToPayment resolves when the PaymentIntent reaches the succeeded state, or when the payment fails and the PaymentIntent returns to the requires_payment_method state. See the PaymentIntent lifecycle for details on how these transitions happen.

To poll yourself, disable automatic polling by setting handleActions: false:

script.js
stripe.confirmPayToPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { payto: { account_number: '000123456', bsb_number: '000000' } } } { handleActions: false } // <---- Like this )

In this case, call the PaymentIntents API to fetch status of the PaymentIntent yourself.

Test your integration

Test your PayTo integration with your test API keys by using the various test PayIDs and bank account details below. Each set of details results in a different scenario your integration might commonly face in live mode.

PayIDDescription
{any_prefix}+succeed@{any_domain}The PaymentIntent status transitions from requires_action to processing after 10 seconds, then transitions to succeeded after an additional 5 seconds.
{any_prefix}+decline@{any_domain}The PaymentIntent status transitions from requires_action to requires_payment_method after 10 seconds. Stripe returns the payment_method_provider_decline error code and an invalid_authorization decline code.
{any_prefix}+expire@{any_domain}The PaymentIntent status transitions from requires_action to requires_payment_method after 10 seconds. Stripe returns the payment_method_provider_timeout error code and a generic_decline decline code.
{any_prefix}+insufficient_funds@{any_domain}The PaymentIntent status transitions from requires_action to processing after 10 seconds, then transitions to requires_payment_method after an additional 5 seconds. Stripe returns the payment_method_provider_decline error code and an insufficient_funds decline code.
{any_prefix}+agreement_type_not_supported@{any_domain}The PaymentIntent status transitions from requires_action to requires_payment_method after 10 seconds. Stripe returns the payment_method_provider_decline error code. The mandate enters an inactive state.

OptionalHandle post-payment events

Stripe sends a payment_intent.succeeded event when the payment completes. Use the Dashboard, a custom webhook, or a partner solution to receive these events and run actions, like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.

Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response. Setting up your integration to listen for asynchronous events also helps you accept more payment methods in the future. Learn about the differences between all supported payment methods.

  • Handle events manually in the Dashboard

    Use the Dashboard to View your test payments in the Dashboard, send email receipts, handle payouts or retry failed payments.

  • Build a custom webhook

    Build a custom webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.

  • Integrate a prebuilt app

    Handle common business events, such as automation or marketing and sales, by integrating a partner application.

Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc