#billmorgan92
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- billmorgan92, 6 days ago, 7 messages
This is possible. After creating the subscription with 7-day trial, pending_setup_intent will be available that can be used to collect the payment method details: https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent
The steps will be:
- Create the subscription with trial and expand
pending_setup_intentfield: https://stripe.com/docs/api/expanding_objects - Use the Setup Intent client secret to collect the payment method details: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#collect-payment-details
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
A pretty standard flow..
- User registers
- Create subscription with a
price_id
const subscription = await this.stripe.subscriptions.create({
customer: customer.id,
items: [{ price }],
collection_method: 'charge_automatically',
trial_period_days,
trial_settings: { end_behavior: { missing_payment_method: 'cancel' } },
payment_settings: { save_default_payment_method: 'on_subscription' },
cancel_at_period_end: true,
metadata: { email },
});
Would I then create a payment intent? or should I avoid using the subscriptions api and creating one after successfully getting their payment information?
With trial, payment intent will not be created, but pending_setup_intent will
so if I use a trial there's no way on getting their payment information?
You can use the pending_setup_intent of the subscription to collect the payment method
what comes first
- a subscription
- a setup intent
?
https://stripe.com/docs/api/subscriptions/object?lang=node#subscription_object-pending_setup_intent you can get a pending_setup_intent from a subscription that doesn't require payment. You don't need to create a seperate setupIntent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
something like this, right?
const subscription = await this.stripe.subscriptions.create({
customer: customer.id,
items: [{ price }],
collection_method: 'charge_automatically',
trial_period_days,
trial_settings: { end_behavior: { missing_payment_method: 'cancel' } },
payment_settings: { save_default_payment_method: 'on_subscription' },
cancel_at_period_end: true,
metadata: { email },
expand: ['pending_setup_intent'],
});
where I expand the pending_setup_intent object to get it back from the stripe response