#s_cloaked_43543

1 messages · Page 1 of 1 (latest)

nova basinBOT
#

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.

desert sleet
#

the subscription object automatically becomes valid. So, if I have monthly and yearly subscription options, a customer can create two subscriptions just by entering a corresponding promo code to each option.
Taking a step back what's your expected flow here though?
Do you want to collect payment method information but subscription moving to active limits that?

olive widget
#

Yes, I'd like to collect the payment info before creating a a valid subscription. With the standard coupons like "20% discount forever" the payment is required. However, the payment is totally optional if I a customer enters the "100% off for 6 months" coupon. The standard flow creates a valid paid $0 subscription without returning a payment intent. We want to start charging the customer after six months. So, my goal is always to collect the payment data before creating a paid subscription object.

nova basinBOT
desert sleet
#

Apologies for the delay

#

things got busy

olive widget
#

np!

desert sleet
#

When you create $0 subscriptions, the subscription has pending_setup_intent property populated

#

you can use that to collect payment method information

#

with elements

#

If the setup intent stays in requires_payment_method status then you can likely just cancel the subscription for the customer Or upto you on how you want to handle this

olive widget
#

yes, I 'm aware of the pending_setup_intent! But if I create a subscription with the 100% discount for the first months it will imediattely creates a paid subscription. So, if a user tries to enter the promo codes for both monthly and annual they have two valid paid subscriptions immediately without entering a payment details, and I need to figure out what subscription should I cancel.

#

Okey, I see. If there is no way to avoid creating a subscription without requiring the payment details from a customer I need to proceed with the coupon properties checks or/and requires_payment_method setup intent check.

desert sleet
#

I mean you can check if the customer has an existing subscription by calling the List Subscriptions API with their customer ID

#

If they do, then just don't call create subscriptions API

olive widget
#

There must be only one pad subscription per customer at a time and the payment method must be present if the subscription is paid even if it's a $0.

chrome flint
#

Yep, so hanzo's suggestion should work well here. Before creating a subscription, you can list the existing subscriptions by customer or by email. If they already have a subscription, you can error out and tell them they already have a subscription https://stripe.com/docs/api/subscriptions/list#list_subscriptions-customer