#Nick137645

1 messages · Page 1 of 1 (latest)

lament tokenBOT
slate topaz
#

Hi, how can we help?

hazy trellis
#

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']);
} ```

Learn how to embed a custom Stripe payment form in your website or application. Build a checkout form with Elements to complete a payment using various payment methods.

#

Is it possible with "Custom payment flow" ?

slate topaz
#

I do not understand the ask, can you reword this so I can better support?

hazy trellis
#

This does not work even though the payment has been validated.
if ($paymentIntent->status === 'succeeded')

slate topaz
#

What do you mean it does not work? What are you really trying to do?

hazy trellis
#

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" ?

slate topaz
#

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.

hazy trellis
#

I accept payment by Cards, Wallet and Bank redirects only.

I do not accept "Buy now, pay later" and Bank debits.

Will this work?

slate topaz
#

Yes but I'd recommend that you listen to webhooks instead.

hazy trellis
#

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?