#xfechx
1 messages · Page 1 of 1 (latest)
can I use this code successfully, or is the customer source required?
What are you trying to do with it, exactly? How is that customer configured?
I thought you were switching to use payment intents, too
I get this error:
Cannot charge a customer that has no active card
Yes, I will, but I have to test something beforehand
can I have the same link that karlleko shared before?
to charge using payment intent?
What do you mean?
That error suggests the customer has no default source set up, but you dont want to go down that rabbit hole
you want ot get payment methods attached and use payment intents with those payment methods
because I just read this
so I need to use payment intent
can you help me on how to make a charge for a customer on the backend using payment intents?
when I already have the customer id
You also need a payment method id that you've saved, but you can do server confirmation following this:
https://stripe.com/docs/payments/accept-a-payment-synchronously
Would this suffice?
$stripe->paymentIntents->create([ 'amount' => $amount * $percentage_fee, 'currency' => $currency, 'customer' => $external_customer, 'payment_method_types' => ['card'], 'description' => get_bloginfo('name') . ' Application Fees', 'metadata' => array( 'API'=> $api, 'Test'=> $test_mode, 'Link'=> get_bloginfo('url'), ) ]);
You can create a payment intent that way, yes, but its not being confirm'd and you cannot do so without a payment method
What are you trying to do, high level? Are you migrating from Charges? What has you stuck?
I am tyring to charge a customer when something else happens
an already saved customer and card
What do you mean payment source? You have a payment collected already and attached ot the customer?
Can you share an example customer id i can look at?
cus_LmOwHcdASdzHbV
ok, yep, so i see that customer and they have a PM attached
so in you code above, you'd want to add:
'payment_method' => 'pm_123_...',
'off_session' => true,
'confirm' => true,
Since you did setup the payment method for off session use
thanks and then that's it?
Well, you might have to handle decline and authentication failure still, etc
but that's it for the basic happy path/testing
it says that I am missing a PM
You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method.
Did you include the PM like i showed here?