#elbek-customer-defaultpm

1 messages · Page 1 of 1 (latest)

hard boneBOT
upper surge
#

Hello

#

You said: ```This PaymentIntent requires a mandate, but no existing mandate was found. Collect mandate acceptance from the customer and try again, providing acceptance data in the mandate_data parameter.

#

Are you trying to charge this bank account using a PaymentIntent?

#

@keen plover tagging you here to make sure you see this thread

keen plover
#

no, I am trying to settle the invoice using bank account as a payment method

#

customer has bank account linked as a payment method

#

then I generated an invoice for the customer

#

strip cannot money out of bank account and fails with this error when we trigger invoice pay

#

@upper surge

upper surge
#

Can you share the request ID where you see this error?

keen plover
#

sure

#

logs/req_IZQBWF0TDH1UiT?t=1707307247

upper surge
#

Thanks, looking

keen plover
upper surge
#

Okay so the issue is that you set the bank account as the invoice_settings.default_payment_method

#

You basically don't want that here

#

Since that is for using PaymentMethods with our newer flow

#

Which requires a mandate

#

Try removing that and just have the bank account set as default_source

#

Then attempt to pay the Invoice again

keen plover
#

Ok, so I need to make bank account as default_source for the customer?

#

Or another question is how do I setup bank account as default source

#

which api I should use?

upper surge
#

It is already the default_source, the issue right now is that it is both

#

It is automatically set as the default_source when you attach it to the Customer

keen plover
#

Thanks Bismark. I will try it. Sounds promising

upper surge
#

👍

keen plover
#

What should be the value for the source field?

#

is it payment method id? something like pm_.... ? @upper surge

upper surge
#

No it would be your bank account ID

hard boneBOT
keen plover
#

I see, makes sense. How about if we want to make cc as a default source

#

what would be the value for the field? @upper surge

upper surge
#

Depends a little bit on your integration

#

Are you working with Card objects?

#

That look like card_xxxx ?

keen plover
#

something like this

#

it is id is pm_

limber otter
#

Hi, stepping in and catching up

keen plover
#

@upper surge

limber otter
#

Bismarck needs to step away, I'll help further here

keen plover
#

Thanks @limber otter

#

the above picture is card I have for the customer

#

it has pm_ id

#

how do we get card_xxx id from it?

limber otter
#

I do not think you'd want to the card_id here, the above payment method is different than what you shared with my teammate.

#

How are you creating the payment method here?

keen plover
#

just a second

#

It calls this to create a session

#

/v1/checkout/sessions

#

req=req_wI2knrgqR3XKJF

#

then

#

it attaches this payment to the customer

#

req=req_CHm4tMJznDNMIY

limber otter
#

Taking a look

keen plover
#

it uses strips element ui

#

from there customer fills the form to attach a pm to himself/herself

limber otter
#

So that one worked correctly, req_x0zYKjnDWxhuoh as you used Stripe Checkout in setup mode. In this case, we collect all necessary data to charge the customer later.

keen plover
#

my question is say if user marks the bank as a default source then later deletes the bank pm but his cc is remaining

#

do I need to update the customer's source to point to cc?

limber otter
#

To add some context, sources is our legacy product. It is recommended that you use Payment Methods like you're doing on that seconds example. When the payment method is detached from the customer, https://stripe.com/docs/api/payment_methods/detach it can't be used anymore. Also, you can only have one default payment method. So, in the case that the payment method is detached, you can set another default payment method to the customer, https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method. You'd need to make this call explicitely.

keen plover
#

I did

#

I set bank as a default payment method

#

then I got the initial error

#

that is how everything started

#

right now ba_xxx is set as invoice's default payment method

#

when ba_xxx is a default pm I get following error

#
{
  "error": {
    "message": "This PaymentIntent requires a mandate, but no existing mandate was found. Collect mandate acceptance from the customer and try again, providing acceptance data in the mandate_data parameter.",
    "request_log_url": "https://dashboard.stripe.com/logs/req_7L0JwCbXgrsMVY?t=1707334241",
    "type": "invalid_request_error"
  }
}
#

then I was tolkd to use default source

#

bank_xxx is linked using plaid

#

How do I set bank account or card as a default payment method?

#

if I use this api it is causing issues as I posted above

#

@limber otter Need your help here

limber otter
#

The initial error is because you're not using the Checkout Session in setup mode. You're creating a token here, https://dashboard.stripe.com/logs/req_vBOTu5Kh6tRU6M. In this case with sources, you need to remove that bank account from the invoice_settings.default_payment_method and just have the bank account set as default_source.

#

You are micing two different flows here. The above recommendation was for when you were using the Payment Method.

keen plover
#

ok, we have multiple pay methods can be setup

#

it can either be bank or card

#

so when bank is set as default then I do use customer.default_source to set as default payment?

limber otter
#

Yeah, so in this case, remove the ba_ from invoice_settings.default_payment_method

keen plover
#

if customer wants to chose cc as a default pm then use invoice_settings.default_payment_method?

keen plover
#

but how about if it is cc

#

do i use this path for making it as a default pay method?

#

for cc case invoice_settings.default_payment_method

limber otter
#

Ah, on the same page now. If you're not creating the card_ with tokens, no. However, if the credit card is from a Payment Method, then yes you'd need to set that up.

keen plover
#

it has pm_xxx on it

limber otter
#

Yeap, in this case, you'd want to make that the invoice_settings.default_payment_method after you removed the bank account.

keen plover
#

got it, thanks, will check it!

#

sounds promising

limber otter
#

Sure!

keen plover
#

ok, it seems it is not remoing from invoice setting

#

can you see this req

#

I am sending source only

#

response has "invoice_settings": { "custom_fields": null, "default_payment_method": "ba_1OMRn3DVbSo80Vu45HnWwsED", "footer": null, "rendering_options": null },

#

what is the right request?

#

to remove default_payment_method from invoice setting to ba_xxx case

limber otter
hard boneBOT