The result of the order will be set in the object $Afterpay->order_result. You can process the order, using the information in the object. Below is an overview of possible resultIDs in the object.
ResultId | Type | Description | Action |
---|---|---|---|
0 | Acceptance | – Payment accepted – Order is registered |
– Redirect to succespage – Order can be processed and shipped |
1 | Exception | – Technical error – Order is not registered |
– Show error message – Order cannot be processed |
2 | Validation | – One or more fields contain invalid data – Order is not registered |
– Show validation error(s) – Provide option to correct data and submit again – Order cannot be processed |
3 | Rejection | – Payment rejected – Order is registered |
– Show rejection message – Enable user to choose a different payment method – Order cannot be processed |
Example return objects
ResultId 0 – Accepted payment
ResultId 1 – Technical error
ResultId 2 – Validation error
ResultId 3 – Rejected payment
Processing messages and descriptions
Each returnobject contains an array with 1 or more
messages: these are for logging and debugging
descriptions: these are to be displayed in the webshop
foreach ($Afterpay->order_result->return->messages as $message) { echo $message['message']; }
Echo’s all the messages in the array.
foreach ($Afterpay->order_result->return->messages as $message) { echo $message['description']; }
Echo’s all the descriptions in the array.