szulbix
szulbix

Reputation: 165

Stripe - how can I create delayed subscriptions

I have a question about this certain flow, I wonder if i can achieve this with Stripe.

Let's say we have user A and B. User A want to rent something from user B. User A clicks a button to rent and then user B gets a notification. If user B accepts notification then subscription is created and user A is charged for the first time, if user B declines then user A gets notification that nothing will happen.

Is this possible to create "delayed" subscriptions like this?

Upvotes: 1

Views: 287

Answers (1)

cjav_dev
cjav_dev

Reputation: 3105

In this scenario, I would collect the payment details for the Subscription using a SetupIntent and storing the PaymentMethod on the Customer. You can do this with the following guide: https://stripe.com/docs/payments/save-and-reuse

After creating the PaymentMethod and attaching to the Customer object, you would then likely want to update the Customer object, setting it's invoice_settings.default_payment_method equal to the ID of the stored PaymentMethod. This will allow you to use that PaymentMethod by default for the Customer with a Billing Subscription.

Then, if a Subscription needs to start, you can then create the Subscription for the Customer later with this API: https://stripe.com/docs/api/subscriptions/create

Upvotes: 2

Related Questions