Skip to content

Commit

Permalink
Merge pull request #704 from fjbender/feature/improve-return-example
Browse files Browse the repository at this point in the history
NTR: Update return.php to include sync poll from API
  • Loading branch information
sandervanhooft authored Dec 19, 2023
2 parents f4f70ab + 9744214 commit 42f4aab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/payments/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@

$status = database_read($_GET["order_id"]);

/*
* The order status is normally updated by the webhook.
* In case the webhook did not yet arrive, we can poll the API synchronously.
*/

if ($status !== "paid") {
$payment = $mollie->payments->get($_GET["order_id"]);
$status = $payment->status;
/*
* Optionally, update the database here, or wait for the webhook to arrive.
*/
}

/*
* Determine the url parts to these example files.
*/
Expand Down

0 comments on commit 42f4aab

Please sign in to comment.