#Carlos Mascarenhas — payment method must be attached

1 messages · Page 1 of 1 (latest)

cyan dust
#

Do you have the request ID (req_123) that you got this error for?

static arrow
#

no

#

pi_3KK6rPANR34g5yeQ0hvLtZOW

#

sub_1KK6rPANR34g5yeQAfhnjgCl

cyan dust
static arrow
#

no

#

I called the signature update method

#

to attach a new payment method to the subscription

cyan dust
#

As the error says, the PM needs to be attached to the customer. If you make that call and then try to update the subscription again that call should work

#

To be attached to the subscription, the payment method needs to be attached to the customer that the subscription is for

static arrow
#

I am following this guide

#

I tested it yesterday and it worked

cyan dust
#

Can you link to the URL?

static arrow
#

I tested this implementation yesterday and it had worked correctly

#

req_MkyedUVDqE7CLQ

cyan dust
#

Thanks. I have been looking in to those. Still looking.

cunning crest
#

Hi Carlos. To set the default payment method on a subscription, it must be already attached to the customer

#

Can you provide the request ID where it worked yesterday? Most likely the payment method used was already attached to the customer

static arrow
cyan dust
#

The example flow should work. Trying to see what might not be lining up here

static arrow
cunning crest
#

Says it was done through the dasboard

static arrow
#

I just did it through the panel, I did it manually since the api wasn't working

static arrow
cunning crest
#

Oh you detached after it wasn't working

#

Ok let me look more then

static arrow
cunning crest
static arrow
#

I'm using confirmCardPayment

cyan dust
#

Good to know. Will see if I can recreate with that.

static arrow
#

I will create a new client and a new subscription and test again

#

same error occurred

#

I create the customer without payment method

create signature

then capture the payment method and confirm using confirmCardPayment

I get the webhook event, I try to attach the payment method to the subscription and the same error occurs

#

The customer does not have a payment method with the ID pm_1KK7qNANR34g5yeQDRfo8e7Y. The payment method must be attached to the customer.

#

req_NM0yt58eTEnfQJ

cyan dust
#

This call is working for me with the flow from the docs. Checking in to what the difference is here

static arrow
#

Ok

static arrow
#

Did you find out anything?

midnight viper
#

👋 I was working with @cyan dust on this and we did find the issue, let me explain quickly

#

The problem stems from the fact that you pass off_session: true on Subscription creation. This is uncommon with default_incomplete usually since if you're "off session" at that point you already have payment method details saved on the customer. IF you don't you have to ask the customer which means you're not off session, they are on session ready to give them to you
So in that situation, the Invoice's underlying PaymentIntent is not configured to "save" the payment method. We think it's a small bug and we're going to look into fixing it.

But why are you using off_session: true in this flow?

static arrow
#

in no time i send off_session: true

midnight viper
static arrow
#

I found the problem

midnight viper
#

I see you seem to use Laravel, so Laravel does that for you maybe? They are a third-party system so maybe it's their default

static arrow
midnight viper
#

ah nice

#

And really, this should still work so we do think it's a bug, just not one we had noticed before. We're going to still get it fixed

static arrow
#

I'm using laravel cashier under the hood it's sending

#

To solve the problem for now should I send off_session=false?

midnight viper
#

The real question is: is the customer going to enter card details or do you have them already? If it's the former, then just don't send the parameter at all (but sending false works too)

static arrow
#

The customer will enter after creating the signature

#

I will send off_session = false then

midnight viper
#

yes that will fix your problem

static arrow
#

Thanks a lot for the help