How To: Automatically set default payment methods in Stripe
How to set up a webhook in Stripe so that, when a payment method is first added to a customer, it is automatically set as the default payment method.
Note: This requires a Stripe component that is set up to create subscriptions
Create a new webhook in Stripe
-
Log in to your Stripe Dashboard.
-
Open the Workbench.
-
Navigate to the Webhooks tab.
-
Click + Add destination.
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.
Add your endpoint and create the webhook
-
In “Endpoint URL”, paste your endpoint URL, which you can grab by asking the Embeddables Team.
-
It should have the format:
https://ierxexdtyashuotcsjyo.supabase.co/functions/v1/webhook_stripe?group_id=<YOUR_GROUP_ID>
. -
Click Create destination.