Hosted Checkout — Quick Start Guide
Prerequisites
- Active CyoGate merchant account
- Private API Key — see Get Your API Keys
- Server capable of HTTPS POST requests
Step 1 — Configure Your Hosted Page
Log in to your Merchant Control Panel → Settings > Hosted Payment Page. Upload your logo, set colors, and configure your redirect URLs and notification URL.
Step 2 — Redirect to Hosted Checkout
<?php
$post = array(
'security_key' => YOUR_PRIVATE_KEY,
'type' => 'sale',
'amount' => '29.99',
'order_id' => 'ORDER-12345',
'order_description' => 'Widget Purchase',
'redirect' => 'https://yoursite.com/thank-you',
);
$ch = curl_init('https://secure.cyogate.net/api/transact.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
parse_str($response, $result);
if ($result['response'] == '1') {
header('Location: ' . $result['form_url']);
exit;
}
?>
Step 3 — Handle the Notification
<?php
// Your notification_url endpoint
if ($_POST['response'] == '1') {
// Approved — fulfill order
fulfill_order($_POST['order_id'], $_POST['transactionid']);
}
?>
Test Cards
| Card Number | Result |
|---|---|
4111111111111111 | Approved |
4111111111111111 with amount 0.01 | Declined |