#MrsRumi-subscription-no-pm

1 messages ยท Page 1 of 1 (latest)

charred solar
#

Hello ๐Ÿ‘‹

#

How are you integrating subscriptions? Are you using Checkout, Elements or something else?

brazen chasm
#

I am using CardElement on the frontend and I use payment_intent for main subscription and setup_intent for first payment 100% discount subscriptions, using the client secrets

#

I am not sure if it was the question

charred solar
#

yup that answers the question ๐Ÿ™‚ thanks

#

I want to cancel automaticaly subscription on Stripe when there is not payment method info.
do you want to cancel it immediately after its created or after the first billing cycle is complete or something else?

brazen chasm
#

the fact is that in some cases users are creating a subscription without entering any payment method, and I dont want this

#

I have solve not aplying de suscription activation on my platform

#

but I have lots of "invalid" subscription activated on Stripe

#

I think about two solutions, better than what I aplied:

  • CardElement on the frontend with the posibility of knowing when is empty
  • Creating the subscription only if the paymentMethod is valid
#

but I dont know if are posible in a easy way

#

Like, taking a propiety from CardElemet for knowing something about the content or adding a property to subscription creation

ruby cloak
#

answering, one sec

#

the fact is that in some cases users are creating a subscription without entering any payment method, and I dont want this

because you're using CardElement, this is in the control of your code that you can only create a Subscription via the API after the user has entered card details in CardElement and after you've created a PaymentMethod object from those card details

additionally, once you create the Subscription with those params above, you can use said PaymentMethod to "confirm" the Subscription's pending_setup_intent with CardElement, so that this PaymentMethod is "set up" for recurring payments after the 100% off Coupon is all used up

brazen chasm
#

yes, this is what I want

#

but, why is doesnt work?

#

do you mean I need to use in front another stripe Element?

ruby cloak
#

no

#

let me re-explain

brazen chasm
#

or I need to add a "verify payment methot button"?

ruby cloak
#

your code mounts CardElement

#

your code creates a Subscription

brazen chasm
#

okey

ruby cloak
#

your code also needs to only create a Subscription after a user has entered their card into CardElement and you've called the Stripe API to create a PaymentMethod out of it

#

does that answer your questions?

brazen chasm
#

yes! thank you very much! ๐Ÿฅฐ

ruby cloak
#

there is one more part after this but want to make sure you're good on this part first

brazen chasm
#

im in

#

you can continue

ruby cloak
#

the part after this to make sure the PaymentMethod is valid is:

when you create a Subscription with a 100% off coupon, there is a pending_setup_intent field on the Subscription. That represents a SetupIntent. That SetupIntent has a client_secret field.

You need to take the PaymentMethod ID and "confirm" the SetupIntent's client_secret using this function from Stripe.js on your frontend: https://stripe.com/docs/js/deprecated/confirm_setup_intent

Confirming a SetupIntent validates the PaymentMethod and sets it up for future recurring payments on the Subscription

#

pls give that a read

brazen chasm
#

of course

#

thankyou very much, you have help me a lot

#

have a good day

#

๐Ÿ˜Š