#excid3-subscription-save

1 messages ยท Page 1 of 1 (latest)

junior cradle
#

@cobalt quest you don't need to do anything specific, it does this for you no?
Are you seeing otherwise?

cobalt quest
#

I am seeing otherwise. The payment_intent generated from the subscription has setup_future_usage=nil

#

I'm trying to create a subscription, get the payment intent, render that in the browser, let the user confirm, then mark their payment method as default

#

on their Customer (not just the subscription)

#

the payment_intent.created event shows that setup_future_usage is null, after being auto-generated by the Subscription#create call

junior cradle
#

sure, but it still will work

#

like did you try to complete that PaymentIntent? Does it not save the PaymentMethod automatically?

cobalt quest
#

"save_default_payment_method": "off"

junior cradle
#

still

cobalt quest
#

Stripe Ruby is submitting it as off now on the latest API version

junior cradle
#

you're just looking at raw JSON and likely misunderstanding

#

did you try to complete that PaymentIntent?

cobalt quest
#

It's completed

#

I'll complete checkout with the Payment Element

#

then on the redirect, I look up the PaymentIntent and the PaymentMethod

#

in order to mark that payment method as teh default invoice settings

#

and I get an error that I can't attach the PaymentMethod to the Customer

#

customer is null on the PaymentMethod, but it's set on the PaymentIntent

junior cradle
#

Sure, can you please share exact/detailed information?

#

Like exact PaymentIntent id you completed

cobalt quest
#

What would you like? I can send you the API logs from Stripe

#

Let me find one that was failing that process

#

pi_3LpE3NKXBGcbgpbZ08Bc5LEq

#

Steps I took on this:

  • PaymentIntent was generated by a subscription
  • Add payment method
  • Confirm payment intent
  • Payment succeeds
  • PaymentMethod is not attached to a customer
junior cradle
#

(looking)

cobalt quest
#

And the subscription was created with off_session: true

#

Take your time ๐Ÿ‘

junior cradle
#

ah I think it's because you passed off_session: true in that Subscription creation

#

do you know why you do that?

cobalt quest
#

Always have

junior cradle
#

it doesn't make sense honestly, you're defaulting to incomplete, you're going to complete it on session

#

so you shouldn't be setting this at all

cobalt quest
#

Gotcha. It's something we've just always had in there since the SCA stuff came out.

#

Let me comment that out and give it a try

#

๐Ÿ‘

junior cradle
#

keep me posted

#

I agree it's quite confusing this behaviour and it's partly why we built the "save" behaviour

cobalt quest
#

I think that did the trick ๐Ÿ‘

junior cradle
#

yay!

cobalt quest
#

It's been pretty confusing, for sure

#

One of the pain points I've been facing is trying to create a Checkout-like experience on a single page in-app. Adding billing and promo codes to a customer / subscription ideally updates that payment intent automatically to recalculate the tax and total price.

#

Hopefully that'll be doable soon. Right now we've got it split into two pages so that we can collect billing address before creating the subscription

junior cradle
#

Yeah that's unfortunately not possible for now though it's something we want to fix.

#

Subscription creation kind of "lock" everything on creation and the underlying Invoice is immutable

cobalt quest
#

That's what I figured. Will be nice to have that!

#

Thanks for your help today! I don't think I would have figured out it was off_session ๐Ÿคช

junior cradle
#

yeah I was writing the question to my team because I was so confused myself

#

I was like "come on I know this works" so I was summarizing all I could find in your request

cobalt quest
#

LOL

junior cradle
#

and literally saw off_session: true as I was going to post my question internally