Skip to main content
This guide is only relevant for Subscription checkout mode.For Payment mode, all you need to do is set “Setup Future Usage” to “Off Session” in the Stripe component options.For Setup mode, you don’t need to do anything - payment methods are automatically set as default in this mode.
When a customer enters their credit card or other payment method for a subscription in Stripe, that payment method is not automatically set as the default payment method. Without this, the next payment in the customer’s subscription may fail, unless you manually set the payment method as the default in your Stripe Dashboard. This guide explains how to set up a Webhook to ensure that when a new payment method is added to a Stripe customer, it is automatically set as the default payment method.
Example: Top customer has a default payment method set; bottom customer does
not, which can cause payment
issues.

Example: The top customer has a default payment method set; the bottom customer does not, which can cause payment issues.

Adding a webhook to automatically set the default payment method in Stripe

  • You have Workbench enabled
  • You don't have Workbench enabled
Note: This requires a Stripe component that is set up to create subscriptions
1

Create a new webhook in Stripe

  • Log in to your Stripe Dashboard.
  • Open the Workbench.
  • Navigate to the Webhooks tab.
  • Click + Add destination.
2

Configure your webhook settings

  • Make sure “Events” is set to as “Your account”.
  • Make sure “API version” is set to “Your current version”.
  • Under “Events”, find the payment_method.attached event and select it.
  • Click Continue.
  • Make sure “Webhook endpoint” is selected and click Continue.
3

Add your endpoint and create the webhook

  • Grab your Project ID from the URL in the Embeddables Web App - it’s the ID after /project/ that starts with pr_.
  • In the “Endpoint URL” field in Stripe, paste the following URL, replacing <YOUR_PROJECT_ID> with your Project ID:
https://webhooks.embeddables.com/webhooks/stripe/payment_method.attached?project_id=<YOUR_PROJECT_ID>
If you’re setting up a webhook for Stripe’s test environment, add &test=true to the end of the endpoint URL.
  • Click Create destination.

Migrating from the old webhook URL to the new format

  • You have Workbench enabled
  • You don't have Workbench enabled

Migrating to the new webhook URL with Workbench enabled

1

Update your webhook endpoint URL

  • Go to your Stripe Dashboard and open the Workbench.
  • Navigate to the Webhooks tab and find your existing webhook for payment_method.attached.
  • Edit the endpoint URL to use the new format:
https://webhooks.embeddables.com/webhooks/stripe/payment_method.attached?project_id=<YOUR_PROJECT_ID>
If you’re setting up a webhook for Stripe’s test environment, add &test=true to the end of the endpoint URL.
  • You can get your project ID from the URL in the Embeddables Web App - it’s the ID after /project/ that starts with pr_.
  • Save your changes.
I