#khoi
1 messages · Page 1 of 1 (latest)
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?
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?
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
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?)
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?
i am listening for webhook charge.succeeded
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"
The call to do that is called "confirm"
https://stripe.com/docs/api/payment_intents/confirm
https://stripe.com/docs/js/payment_intents/confirm_payment
ah we capture stripe payment method
and pass the payment method id in stripe payment intent
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