Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTR: Update return.php to include sync poll from API #704

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading