#tingwei-charge-migration

1 messages · Page 1 of 1 (latest)

smoky ferry
#

@wanton dagger usually the flow is
1/ Create a PaymentIntent server-side
2/ Client-side get the client_secret and use the PaymentElement to confirm the PaymentIntent

So a PaymentIntent starts in requires_payment_method and then gets confirmed client-side

wanton dagger
#

I have set confirmation_method = automatic. I believe the client-side will confirm?

smoky ferry
#

you don't have to set confirmation_method at all, it's the default. But yes the client will confirm

wanton dagger
#

Does that mean after i create a payment intent i need to call the follow
payment_confirm = \Stripe\PaymentIntent::confirm(
$payment_intent->id
);

smoky ferry
#

not at all

#

You create the PaymentIntent first, in PHP. And then you go to your client, in the browser, and then you confirm it as you collect payment method details

wanton dagger
#

looking into it. everything was perfectly fine in Charge. just cant get it to work using paymentintent method

smoky ferry
#

PaymentIntent and Charge work completely differently though @wanton dagger, that means an entire rewrite of your integration to flip the entire flow over

#

I'm happy to help but you haven't given me much yet. Does your customer have a payment method attached already?

wanton dagger
#

yes. i think i am missing step 2 in the migration.

smoky ferry
#

possibly, it's hard to say for me right now with so little information. Do you have a bit more to share?

wanton dagger
#

so on my server side i have created $payment_intent = \Stripe\PaymentIntent::create([])

#

i believe i need
stripe.confirmCardPayment(
INTENT_SECRET_FROM_STEP_1,
{
payment_method: {card: cardElement}
}
).then(function(result) {
if (result.error) {
// Display error.message in your UI.
} else {
// The payment has succeeded
// Display a success message
}
});

#

how does client side receive the secret

smoky ferry
wanton dagger
#

does Charge supports application fee as well?

smoky ferry
#

Charge is the old way, and always supported application fees. PaymentIntents is the newer path and also supports it, yes