Accéder directement au contenu
Créez un compte ou connecter-vous
Logo de la documentation Stripe
/
Demander à l'assistant IA
Créez un compteConnectez-vous
Démarrer
Paiements
Revenus
Plateformes et places de marché
Gestion de fonds
Ressources pour les développeurs
API et SDKAide

Remarque

Cette page n'est pas encore disponible dans cette langue. Nous faisons tout notre possible pour proposer notre documentation dans davantage de langues et nous vous fournirons la version traduite dès qu'elle sera disponible.

Accept subscription payments with PayTo

Learn how to create and charge for a subscription with PayTo.

Use this guide to set up a subscription using PayTo as a payment method.

You can use the Checkout API to create and confirm a subscription with a prebuilt checkout page.

Create a product and price
Dashboard

Products represent the item or service you’re selling. Prices define how much and how frequently you charge for a product. This includes how much the product costs, what currency you accept, and whether it’s a one-time or recurring charge. If you only have a few products and prices, create and manage them in the Dashboard.

This guide uses a stock photo service as an example and charges customers a 15 AUD monthly subscription. To model this:

  1. Go to the Products page and click Create product.
  2. Enter a Name for the product. You can optionally add a Description and upload an image of the product.
  3. Select a Product tax code. Learn more about product tax codes.
  4. Select Recurring. Then enter 15 for the price and select AUD as the currency.
  5. Choose whether to Include tax in price. You can either use the default value from your tax settings or set the value manually. In this example, select Auto.
  6. Select Monthly for the Billing period.
  7. Click More pricing options. Then select Flat rate as the pricing model for this example. Learn more about flat rate and other pricing models.
  8. Add an internal Price description and Lookup key to organize, query, and update specific prices in the future.
  9. Click Next. Then click Add product.

After you create the product and the price, record the price ID so you can use it in subsequent steps. The pricing page displays the ID and it looks similar to this: price_G0FvDp6vZvdwRZ.

Create a Checkout Session
Server-side

Your customer must authorize you to use their bank account for future payments through Stripe Checkout. This allows you to accept PayTo payments. Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.

index.html
<html> <head> <title>Checkout</title> </head> <body> <form action="/create-checkout-session" method="POST"> <button type="submit">Checkout</button> </form> </body> </html>

Create a Checkout Session in subscription mode to collect the required information. After creating the Checkout Session, redirect your customer to the URL that the response returns.

Limit the amount on your mandates by setting amount in the payment_method_options as several banks always reject mandates without an amount specified.

Command Line
cURL
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ --data-urlencode success_url="https://example.com/success" \ --data-urlencode cancel_url="https://example.com/cancel" \ -d "line_items[0][price]"={{RECURRING_PRICE_ID}} \ -d "line_items[0][quantity]"=1 \ -d "payment_method_types[0]"=card \ -d "payment_method_types[1]"=payto \ -d "payment_method_options[payto][mandate_options][amount]"=1500 \ -d mode=subscription

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. The mandate enters an active state.
{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. The mandate enters an inactive state.
{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_decline error code and a generic_decline decline code. The mandate enters an inactive state.
{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. The mandate enters an inactive state.
{any_prefix}+revoke@{any_domain}The PaymentIntent status transitions from requires_action to processing after 10 seconds then to succeeded after a further 5 seconds. The mandate begins in an active state and transitions to inactive after 1 minute.
{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.
Cette page vous a-t-elle été utile ?
OuiNon
  • Besoin d'aide ? Contactez le service Support.
  • Consultez notre log des modifications.
  • Des questions ? Contactez l'équipe commerciale.
  • LLM ? Lire llms.txt.
  • Propulsé par Markdoc