#joelbermudez
1 messages · Page 1 of 1 (latest)
Not sure I understand exactly. Can't you just retrieve the payment intent and check its amount?
That's what I want to achieve. What would be the code.
Should I do like
$amountPaymentIntent = $retrieve->amount;
??
So I can do something like:
else {
$paymentId = $_SESSION['paymentId'];
$retrieve = $stripe->paymentIntents->retrieve(
$paymentId,
[]
);
$amountPaymentIntent = $retrieve->amount;
if ($amountPayment == $amountPaymentIntent) {
$client_secret = $retrieve->client_secret;
} else {
$intent = $stripe->paymentIntents->create([
'amount' => $amountPayment,
'currency' => 'eur',
'setup_future_usage' => 'off_session',
'customer' => $customer_id,
'payment_method_types' => ['sepa_debit'],
'metadata' => ['integration_check' => 'sepa_debit_accept_a_payment'],
'statement_descriptor' => 'Membership',
]);
$client_secret = $intent->client_secret;
$_SESSION['paymentId'] = $intent->id;
}
}
Is that correct?
I'm gonna test it now
Works as expected. Thanks
No problem