Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseUse Managed Payments
Use Payment Links
Use a pre-built checkout page
Build a custom integration with Elements
Build an in-app integration
Payment Methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app payments
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Agentic commerce
    Overview
    Build your checkout flow for agentic commerce
    Testing
    Integrate the Agentic Commerce Protocol
Financial Connections
Climate
Understand fraud
Radar fraud protection
Manage disputes
Verify identities
HomePaymentsAgentic commerce

TestingPrivate preview

Learn how to test processing shared payment tokens.

After you create a granted SharedPaymentToken object using a PaymentMethod, you can test the functionality of Shared Payment Tokens in an agent by using the token to create a PaymentIntent.

Create a Shared Payment Token

To grant your account a Shared Payment Token using a PaymentMethod, you can collect payment details directly from the buyer or use a test PaymentMethod. The following code example demonstrates an agent issuing a Shared Payment Token and sharing it with you.

curl https://api.stripe.com/v1/test_helpers/shared_payment/granted_tokens \ -u "sk:" \ -d payment_method=pm_card_visa \ -d "usage_limits[currency]"=usd \ -d "usage_limits[max_amount]"=10000 \ -d "usage_limits[expires_at]"=time_in_future \ -d "seller_details[network_id]"=stripe_test_platform \ -d "seller_details[external_id]"=stripe_test_merchant

Create and confirm a PaymentIntent

Next, create a PaymentIntent using the SharedPaymentToken object. The following code example demonstrates how you, as the seller, use the SharedPaymentToken to create a payment.

curl https://api.stripe.com/v1/payment_intents \ -u "sk:" \ -d amount=10000 \ -d currency=usd \ -d confirm=true \ -d "payment_method_types[]"=card \ -d shared_payment_token=spt_123

Listen for webhook events

As the seller, you can listen for usage events related to the SharedPaymentToken to track its use during transactions. The following event notifies you when the SharedPaymentToken has been used.

shared_payment.granted_token.used
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access programme.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc