#khoi

1 messages · Page 1 of 1 (latest)

inner troutBOT
gritty night
#

There is not a card to do that, you would have to simulate the behavior itself. Like having test code to ignore the incoming event

#

Can you tell me more about what you are trying to test here?

wanton laurel
#

i am showing a spinner and poll order status

#

and want to make sure payment actually completes

#

or rather in what scenario would capture payment intent succeeds and webhook fails?

gritty night
#

The webhook would fail if your server/network are having issues. In those cases Stripe will keep resending the event until your server acknowledges it (though it takes longer between each retry in case you are down for longer)

#

So in that case, you will always get the payment event, just not immediately. You can try retrieving the payment intent via the API to confirm its status as well

wanton laurel
#
            automatic_payment_methods={"enabled": True},
            idempotency_key=idempotency_key,
            **additional_payload,
            on_behalf_of=seller_stripe_account_id,
            amount=inputs["amount"],
            currency="usd",
            transfer_group=transfer_group,
            metadata=inputs["metadata"],
            shipping=inputs["shipping"],
        )
        return intent``
#

oh so if i do this, and it's successful, then i am guaranteed a successful charge?

#

i dont need to wait for webhook (in case bank async rejects the payment?)

gritty night
#

In that code, you are just creating the payment intent, it needs to be confirmed to actually charge the customer

#

How are you confirming these payment intents?

wanton laurel
#

i am listening for webhook charge.succeeded

gritty night
#

I think there is a slight mismatch in terminology here, I more mean "what API call are you making to tell Stripe to actually charge the user"

wanton laurel
#

ah we capture stripe payment method

#

and pass the payment method id in stripe payment intent

gritty night
#

So if the capture call succeeds, the payment will be successful. You will probably want confirm that by checkout the payment intent's status and I think amount_received if you are doing separate auth and capture

wanton laurel
#

oo

#

so we dont really need to wait for stripe webhook