$response = Easypay_request::commit_payment_request($paymentId, $config, $reqId); if ($response->is_success()) { echo "<h2>Success</h2>"; } else { echo "<h2>ERROR</h2>"; /** @var Message $msg */ $messages = $response->get_messages(); if (count($messages) > 0) { foreach ($messages as $msg) { echo "<p><strong>" . $msg->get_code() . "</strong>, " . $msg->get_field() . ", " . $msg->get_message() . "</p>"; } } else { echo "<h2>ERROR</h2>"; echo "<strong>" . $response->get_exception() . "</strong>"; } } } else { echo "<h2>ERROR</h2>"; echo "<strong>Purchase terminated with state: '" . $purchase . "'</strong>"; } if (isset($_GET['paymentId'])) { echo "<form method=\"get\" action=\"easypay_controller.php\"><input type=\"hidden\" name=\"paymentId\" value=\"" . $_GET['paymentId'] . "\" ><input type=\"submit\" name=\"status\" value=\"Get Payment Status\"/></form>"; } } elseif (isset($_GET['status']) && $_GET['paymentId']) { $paymentId = $_GET['paymentId']; $reqId = "req-id-123"; $config->set_basepath("/ce-rest-service"); $response = Easypay_request::get_payment_status($paymentId, $config, $reqId); echo "<h2>STATUS " . $response->get_status() . "</h2>"; echo "<p><strong>MSISDN: " . $response->get_formatted_msisdn() . "</strong>, OrderID: " . $response->get_order_ID() . ", Payment Info: " . $response->get_payment_info() . ", CHF " . $response->get_amount() . "</p>"; }