#paymentplugins-paymentintent-type

1 messages · Page 1 of 1 (latest)

knotty pumiceBOT
sonic wigeon
#

paymentplugins-paymentintent-type

#

that PaymentIntent seems to have a PaymentMethod already attached

north oak
#

Let me try and find a better example for you, one sec.

#

While I am looking in the logs, is there a way to remove the payment_method from the PaymentIntent during the PaymentIntent update call?

sonic wigeon
#

why don't you attach both types to avoid the problem?

#

but try payment_method: '' otherwise

north oak
#

Because we don't use the UPE to display all payment methods, just credit cards. The other payment methods like Klarna, Afterpay etc are rendered as separate payment methods

#

If we include klarna in the payment_method_types array, then the UPE will render it alongside the credit card form

sonic wigeon
#

I don't really get what that means. Once you update, it's there anyway. Why not set card and klarna in that specific call?

north oak
#

When we make the update call, we only include the current payment method that the customer has selected. So if Klarna is selected it's payment_method_types = ['klarna'] Or if they select Afterpay it's payment_method_types = ['afterpay']

#

Here is a better example: PI: pi_3Lv5BABqelKbGaay1RQHx1tP

#

Request ID: req_ZUl3r1Jf4JBBAd

#

The customer chose Afterpay, then looks like they changed their mind and selected Klarna. When the PaymentIntent was updated, the request failed.

#

I guess because there was already a payment method associated with the PaymentIntent that was for Afterpay?

sonic wigeon
#

yeah because it has a pm_123 attached that's afterpay

#

just put both types to solve the problem right?

#

or remove the PM payment_method: '' too?

north oak
#

Ya if we can remove the PM by setting it to an empty string then that should work

#

I'll test some API requests with that method. Thanks for the assist

sonic wigeon
#

let me know if that doesn't work

north oak
#

Ok, will take me about 10 min to test

sonic wigeon
#

no rush I'm around!

north oak
#

Here is the API error we got when updating the payment intent and setting payment_method = ''. You passed an empty string for 'payment_method'. We assume empty values are an attempt to unset a parameter; however 'payment_method' cannot be unset. You should remove 'payment_method' from your request or supply a non-empty value.

#

So it looks like once the payment method is attached to the payment intent, it can't be unset

sonic wigeon
#

yeah that feels like something we could/should improve

#

so for now pass both types I would say

north oak
#

Ok I will give that a try next. Thanks again

#

That worked. Ok cool, we will just update our code to accept multiple payment types when it's a PaymentIntent update call. 👍

sonic wigeon
#

awesome