#Nick137645
1 messages · Page 1 of 1 (latest)
Hi, how can we help?
I use "Custom payment flow" https://stripe.com/docs/payments/quickstart.
I would like to know the status of an initiated payment without having to wait for a webhook response.
This does not work, however the payment is validated with success. ```// Create a PaymentIntent with amount and currency
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount($jsonObj->items),
'customer' => $customer->id,
'currency' => 'usd',
'automatic_payment_methods' => [
'enabled' => false,
],
]);
// Check payment status
if ($paymentIntent->status === 'succeeded') {
// Upgrade user to premium account
$user_update = upgradeUserToPremium($pdo, $_SESSION['user_id']);
} ```
Is it possible with "Custom payment flow" ?
I do not understand the ask, can you reword this so I can better support?
This does not work even though the payment has been validated.
if ($paymentIntent->status === 'succeeded')
What do you mean it does not work? What are you really trying to do?
I want to retrieve the payment status "StripePaymentIntent::create", if the payment is successful then I run a function to upgrade my customer's account.
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount($jsonObj->items),
'customer' => $customer->id,
'currency' => 'usd',
'automatic_payment_methods' => [
'enabled' => false,
],
]);
// Check payment status
if ($paymentIntent->status === 'succeeded') {
// Upgrade user to premium account
$user_update = upgradeUserToPremium($pdo, $_SESSION['user_id']);
} ```
I try to retrieve the status of the payment this way after using "\StripePaymentIntent::create
if ($paymentIntent->status === 'succeeded')
Is it possible with "Custom payment flow" ?
Yes, what you're describing should be possible but why would you want to do this? It would only action Payment Intents that succeed right away.
It won't work with asynchronous payments such as ACH Direct Debit etc.
I accept payment by Cards, Wallet and Bank redirects only.
I do not accept "Buy now, pay later" and Bank debits.
Will this work?
Yes but I'd recommend that you listen to webhooks instead.
I understand but webhook has difficulties to pass the security of cloudflare and the security policy of my server which is very strict.
3 out of 10 payments the webhook does not reach my server
Is the webhook in real time when the user validates the payment or is there a delay of a few minutes?