#geimsdin-SubscriptionSchedule

1 messages · Page 1 of 1 (latest)

dusky knot
#

Do you have the request id? or the Subscription Id?

languid fiber
#

Hi, this is the payment id: pi_3Ld3IdLmxBucQd150G6XssHf
This is the sub id: sub_1Ld3IbLmxBucQd15Lfh2VG5m

dusky knot
#

Okie so you created a Sub Schedule. It generated a Subscription and an Invoice, a PaymentIntent underlying. But I think you haven't confirmed the PaymentIntent

#

The customer used for the Subscription does have a lot of Payment Method attached, but none was set as their default

#

So the Subscription won't "automatically" choose a PaymentMethod to charge

languid fiber
#

mmm... ok, I check on that

#

I don't know if it is wrong but I create a new customer for every schedule I create, is that correct or Stripe che create it automatically and recognize if the same customer is creating a new sub?

dusky knot
#

Not sure about that recognize part. You pass a customer id when create the Sub Schedule and it will be used

#

A side note that your account is still having the warning

Your account's business owner information needs review
We couldn’t verify the information provided about your business owner.

languid fiber
#

This account is only used for developing purposes in test mode

#

How to set the last payment method as the default?

dusky knot
#

Yes but Charge and Payout are restricted. It could block some functionality of automatic transition

#

How to set the last payment method as the default?
set it in the customer's invoice_settings.default_payment_method

languid fiber
#

Ok then I need to retrieve the payment method, store it and then update the invoice before requesting the payment

languid fiber
dusky knot
#

It can have. I am not sure by 100% but I would suggest just verify the Business information to get rid of it

languid fiber
#

STRIPE CLI on my account can charge without problems, I guess it works because of that, is just my code is missing the default payment method in the phase (I hope)

dusky knot
#

Let's try it first

languid fiber
#

Where qould you suggest me to retrieve the payment method id?

#

When I get that data back from STRIPE?

dusky knot
#

It depends on your integration. How did you create the Payment Method Id?

#

If you confirmed a PaymentIntent earlier, then you will have webhook events

languid fiber
#

I create the payment method using STRIPE js Elements

#

I don't create myself a payment method ID

#

I guess then I try to retrieve it by webhook

#

payment_intent.created is one of the event I receive

dusky knot
#

So you created the Payment Method first, then create PaymentIntent specifying that Payment Method?

languid fiber
#

After I create the Payment Method I attach it to the client and I create a Subscription Schedule always attached to the client

#

But I never included in the subscription Phase the default payment method

#

I'm making some confusion, let me test the code after the information you gave me and I will be back in case it doesn't work

dusky knot
#

Sure

languid fiber
#

Can I set a payment intent as default payment method or they are 2 totally different things?

dusky knot
#

no they are different. pi_xxx vs. pm_xxx

languid fiber
#

Then I never get the payment method

dusky knot
#

Can you share the payment method id?

languid fiber
#

No because I don't get it through API

#

I try to explain the flow

#

1 - I create a payment element from STRIPE JS

dusky knot
#

Look here and you would see your request initiated in step 1

languid fiber
#

2 - if the payment element is submitted succesfully I create a Subscription schedule connected to the customer

#

Ok, nice and thanks I didn't know I can see all my logs

#

But still I don't understand when I get back a payment method id

#

I don't get it from the payment element submission

dusky knot
#

You use the Payment Element correct? What client secret you supply to it? a SetupIntent?

languid fiber
#

I create the setupintent attached to the customer

#

then with that data I create the payment element

dusky knot
#

Inside that webhook event, you will have the SetupIntent object, which will have the Payment Method id

languid fiber
#

Ok, I log that event now, will get back to you

#

Yeeeah...

"payment_method": "pm_1Ld4LiLmxBucQd15mnUdmXXk",

#

I got it, thanks

dusky knot
#

That's the Update Customer API

languid fiber
#

Is it not better to set it in the subscription phase? So that every recurring invoice will use that

dusky knot
#

That could work too. Setting here will automatically take the pm for any Subscription from now on, tho

languid fiber
#

Ok

#

I try

languid fiber
#

missing - card
Cannot charge a customer that has no active card

#

Now I get this

#

should I try to set the default payment method directly on the customer? I would avoid that because a customer could choose to pay one product with a card and another one with another card.

dusky knot
#

Yes it's up to you, to set default on Customer level or Subscription level