Gateways::validatePaymentAmount()
Makes sure a payment actually covers the order it is about to complete
Gateways::validatePaymentAmount(int $amount, null|string $currency, Wagnerwagner\Merx\OrderPage $virtualOrderPage): void
Parameters
| Name | Type | Default |
|---|---|---|
$amount |
int |
- |
$currency |
null or string |
- |
$virtualOrderPage |
OrderPage |
- |
Return type
void
Exceptions
| Type | Description |
|---|---|
Exception |
merx.amountMismatch when amount or currency do not match the cart |
Description
A Stripe PaymentIntent is created when the client secret is fetched and
keeps the cart total of that moment. The cart stays editable until the
checkout, so both can drift apart: the order would list goods the payment
does not pay for. Correcting the amount is the frontend’s job — it has to
fetch a new client secret when the cart changes — so this only refuses.