#tingwei-charge-migration
1 messages · Page 1 of 1 (latest)
@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
I have set confirmation_method = automatic. I believe the client-side will confirm?
you don't have to set confirmation_method at all, it's the default. But yes the client will confirm
Does that mean after i create a payment intent i need to call the follow
payment_confirm = \Stripe\PaymentIntent::confirm(
$payment_intent->id
);
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
I recommend just reading https://stripe.com/docs/payments/accept-a-payment
looking into it. everything was perfectly fine in Charge. just cant get it to work using paymentintent method
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?
yes. i think i am missing step 2 in the migration.
possibly, it's hard to say for me right now with so little information. Do you have a bit more to share?
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
your code sends it to the client, it really depends on your own set up/integration. I do recommend just reading https://stripe.com/docs/payments/accept-a-payment entirely at this point, it will teach you everything you need
does Charge supports application fee as well?
Charge is the old way, and always supported application fees. PaymentIntents is the newer path and also supports it, yes