カテゴリー:
QA
閲覧数:325 配信日:2019-04-24 08:52
質問履歴38
Difference between “paymentIntent.status === 'succeeded'” and “payment_intent.succeeded event of Webhook”
・2019/4/24
The difference between the two is only the following content?
・ Execute on the client side
・ Execute on the server side
Is essentially the same thing?
・ Can I use any of them?
paymentIntent.status === 'succeeded'
・js
"payment_intent.succeeded event of Webhook"
・PHP
・ Execute on the client side
・ Execute on the server side
Is essentially the same thing?
・ Can I use any of them?
paymentIntent.status === 'succeeded'
・js
(async () => {
let {paymentIntent, error} = await stripe.handleCardPayment(clientSecret);
if (error) {
// Handle error here
} else if (paymentIntent && paymentIntent.status === 'succeeded') {
// Handle successful payment here
}
})();
"payment_intent.succeeded event of Webhook"
・PHP
$event = null;
try {
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
// Invalid payload
http_response_code(400); // PHP 5.4 or greater
exit();
} catch(\Stripe\Error\SignatureVerification $e) {
// Invalid signature
http_response_code(400); // PHP 5.4 or greater
exit();
}
if ($event->type == "payment_intent.succeeded") {
・Difference between "paymentIntent.status === 'succeeded'" and "payment_intent.succeeded event of Webhook"