#billmorgan92

1 messages · Page 1 of 1 (latest)

bold shadowBOT
#

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.

steady bluff
#

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:

  1. Create the subscription with trial and expand pending_setup_intent field: https://stripe.com/docs/api/expanding_objects
  2. 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

Learn how to save payment details and charge your customers later.

covert igloo
#

A pretty standard flow..

  1. User registers
  2. 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?

bold shadowBOT
steady bluff
#

With trial, payment intent will not be created, but pending_setup_intent will

covert igloo
#

so if I use a trial there's no way on getting their payment information?

ionic socket
#

You can use the pending_setup_intent of the subscription to collect the payment method

covert igloo
#

what comes first

  • a subscription
  • a setup intent
    ?
ionic socket
covert igloo
#

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

ionic socket
#

Do you know howo to use SetupIntent to collect a payment method?