less than a minute read • Updated 19 minutes ago
Enable the pre-payment webhook
How to turn on the pre-payment webhook for a payment set — useful for last-minute inventory checks, fraud screening, or custom validation before a transaction reaches your gateway.
Steps
In the new admin:
Settings
Pre-payment hook URL
The URL for the endpoint script, which must be HTTPS, that will receive the JSON payload.
Failure handling
If your endpoint script fails to load or respond correctly, this setting controls whether the transaction is automatically approved or rejected. If set to reject, a generic error message is returned — you can edit that message from the “language” section of your store’s administration, under the “checkout” group, looking for the “error precheckout hook” language string.
Notes
Requests to your webhook endpoint also include several special headers:
Header | Description |
|---|---|
| Name of the event that triggered this payload. Currently |
| The ID of the store this webhook was triggered for |
| The store domain this webhook was triggered for |
The pre-payment webhook is primarily triggered right before payment is sent to your gateway (
validation/payment). For some gateways, it’s also triggered before 3D Secure authentication (validation/3ds): Opayo, Barclaycard, and PayPal Commerce Platform. On PayPal Commerce Platform,validation/3dsis only sent for card payments entered on the checkout, not for the PayPal button or Fastlane.On Barclaycard, and on PayPal Commerce Platform card payments, the card is charged as part of the 3D Secure step. That makes
validation/3dsthe last check before the payment is taken. Run the same validation logic for both events, and reject atvalidation/3dsif you need to stop a payment.