Implement Backend

Payment Gateway API Quick Reference

A concise reference for all core CyoGate gateway API operations. All requests use HTTPS POST to the gateway endpoint with your Private API Key for authentication, unless otherwise noted.

Gateway Endpoints

PurposeEndpoint
Transactions (sale, auth, void, refund, vault, recurring)https://secure.cyogate.net/api/transact.php
Query (transaction history, vault records, subscriptions)https://secure.cyogate.net/api/query.php
3D Secure authenticationhttps://secure.cyogate.net/api/3ds.php

Authentication

Include your Private API Key as a POST field in every request:

security_key=YOUR_PRIVATE_KEY
Never expose your Private API Key in client-side JavaScript, mobile app code, or source control. All calls using the Private Key must be server-side only.

Transactions

Process payments, authorizations, captures, voids, and refunds.

Transaction Type Values

typeDescription
saleAuthorize and capture immediately
authAuthorize only — capture later with capture
captureCapture a prior authorization (requires transactionid)
voidCancel an unsettled transaction (requires transactionid)
refundRefund a settled transaction (requires transactionid)
creditPush funds to a card — Account Funding Transactions (AFT)

Core Request Fields

FieldRequiredDescription
security_keyYesYour Private API Key
typeYesTransaction type (see above)
amountYesTransaction amount, e.g. 29.99
payment_tokenYes*Token from Collect.js — replaces raw card data
customer_vault_idYes*Vault ID — alternative to payment_token for returning customers
transactionidCapture/Void/RefundOriginal transaction ID to act upon
order_idNoYour unique order reference (echoed back in notifications)
order_descriptionNoDescription shown on receipt and in reporting
ipaddressNoCustomer IP address (recommended for fraud screening)
firstname / lastnameNoCardholder name
emailNoCustomer email for digital receipts
address1, city, state, zipNoBilling address — improves AVS match rate
countryNo2-letter ISO country code, e.g. US
tax_amountNoTax portion of the total amount
shipping_amountNoShipping portion of the total amount
surchargeNoCredit card surcharge amount (separate line item on receipt)
currencyNoISO 4217 currency code, default USD

Code Examples

PHP

$post = array(
    'security_key'  => YOUR_PRIVATE_KEY,
    'type'          => 'sale',
    'amount'        => '29.99',
    'payment_token' => $_POST['payment_token'],  // From Collect.js
    'order_id'      => 'ORDER-123',
    'email'         => $customer_email,
);
$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);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$response = curl_exec($ch);
curl_close($ch);
parse_str($response, $result);
// $result['response'] == '1' means approved

Python

import requests
from urllib.parse import parse_qs

payload = {
    'security_key':  PRIVATE_KEY,
    'type':          'sale',
    'amount':        '29.99',
    'payment_token': request.POST.get('payment_token'),
    'order_id':      'ORDER-123',
}
response = requests.post(
    'https://secure.cyogate.net/api/transact.php',
    data=payload,
    timeout=30
)
result = {k: v[0] for k, v in parse_qs(response.text).items()}
# result['response'] == '1' means approved

curl

curl -X POST https://secure.cyogate.net/api/transact.php   -d "security_key=YOUR_PRIVATE_KEY"   -d "type=sale"   -d "amount=29.99"   -d "payment_token=YOUR_TOKEN"   -d "order_id=ORDER-123"

Transaction Response Fields

FieldDescription
response1=Approved, 2=Declined, 3=Error
responsetextHuman-readable result message
authcodeCard network authorization code
transactionidUnique gateway transaction ID — always store this
avsresponseAddress Verification result (see AVS codes below)
cvvresponseCVV verification result (see CVV codes below)
amountApproved amount (may differ on partial approvals)
orderidYour order ID echoed back
typeTransaction type echoed back

Common Decline Response Text

responsetextMeaningRecommended Action
DECLINEGeneric decline from issuerAsk customer to use a different card
INSUFFICIENT FUNDSCard has insufficient balanceAsk customer to use a different card
CARD EXPIREDCard expiry date has passedAsk customer to check expiry or use a different card
INVALID CARDCard number failed validationAsk customer to re-enter card number
NO SUCH ISSUERCard BIN not recognizedAsk customer to use a different card
PICK UP CARDIssuer requests card be retainedDo not attempt retry — contact issuer
LOST/STOLENCard reported lost or stolenDo not retry — flag for review
DO NOT HONORIssuer declined without reasonAsk customer to contact their bank
TRANSACTION NOT ALLOWEDCard not enabled for this transaction typeAsk customer to use a different card
DUPLICATE TRANSACTIONSame amount/card processed recentlyCheck if original transaction approved before retrying
CVV FAILURECVV code did not matchAsk customer to verify CVV
AVS FAILUREAddress verification failed (if hard rejection configured)Ask customer to verify billing address
AMOUNT EXCEEDS LIMITTransaction exceeds card or merchant limitSplit into smaller transactions or contact CyoGate

AVS Response Codes

Returned in the avsresponse field. AVS compares the billing address submitted against what the card issuer has on file.

CodeMeaning
XExact match — street address and 9-digit ZIP both match
YExact match — street address and 5-digit ZIP both match
AStreet address matches, ZIP does not
W9-digit ZIP matches, street address does not
Z5-digit ZIP matches, street address does not
PZIP matches, street address not verified (international)
NNeither street address nor ZIP match
UAddress information unavailable — issuer does not support AVS
SAVS not supported by card issuer
RSystem unavailable — retry
EAVS error — data not provided or incorrect format
GNon-US card issuer — does not support AVS
BStreet address matches, ZIP not verified (international)
CStreet address and ZIP not verified (international)
DStreet address and ZIP match (international)

CVV Response Codes

Returned in the cvvresponse field.

CodeMeaning
MCVV match
NCVV does not match
PNot processed
SCVV should be present but was not provided
UIssuer does not support CVV verification

Customer Vault

Store and manage customer payment credentials on CyoGate's PCI-compliant servers for repeat billing and one-click checkout.

Vault Operations

customer_vault valueDescription
add_customerStore a new payment method (optionally with a simultaneous charge)
update_customerUpdate billing info or replace stored payment method
delete_customerPermanently remove a vault record

Key Vault Fields

FieldDescription
customer_vaultOperation to perform (see above)
customer_vault_idYour custom ID for the vault record — auto-assigned if omitted
payment_tokenCollect.js token to store as the payment method

Code Examples

PHP — Add to Vault During Sale

$post = array(
    'security_key'      => YOUR_PRIVATE_KEY,
    'type'              => 'sale',
    'amount'            => '29.99',
    'payment_token'     => $token,
    'customer_vault'    => 'add_customer',
    'customer_vault_id' => 'CUST-' . $user_id,
);

Python — Charge a Vaulted Customer

payload = {
    'security_key':      PRIVATE_KEY,
    'type':              'sale',
    'amount':            '49.99',
    'customer_vault_id': 'CUST-12345',
    'order_id':          'ORDER-456',
}

curl — Delete a Vault Record

curl -X POST https://secure.cyogate.net/api/transact.php   -d "security_key=YOUR_PRIVATE_KEY"   -d "customer_vault=delete_customer"   -d "customer_vault_id=CUST-12345"

See also: Customer Vault Overview | Adding Customers | Credential on File Best Practices

Recurring Billing

Create and manage subscription and installment plans tied to Customer Vault records.

Subscription Operations

recurring valueDescription
add_subscriptionCreate a new recurring plan
update_subscriptionModify an existing plan
delete_subscriptionCancel a subscription permanently

Subscription Fields

FieldRequiredDescription
plan_amountYesAmount to charge each billing cycle
plan_paymentsYesNumber of payments — 0 for indefinite
month_frequencyYes*Bill every N months (1–24). Use instead of day_frequency.
day_frequencyYes*Bill every N days (1–365). Use instead of month_frequency.
day_of_monthNoDay of month to bill when using monthly frequency (1–31)
start_dateYesDate of first recurring charge — format YYYY-MM-DD
subscription_idUpdate/DeleteID of subscription to modify or cancel

Code Examples

PHP — Create Monthly Subscription

$post = array(
    'security_key'      => YOUR_PRIVATE_KEY,
    'type'              => 'sale',
    'amount'            => '9.99',
    'customer_vault_id' => 'CUST-12345',
    'recurring'         => 'add_subscription',
    'plan_payments'     => '0',
    'plan_amount'       => '9.99',
    'month_frequency'   => '1',
    'day_of_month'      => '1',
    'start_date'        => date('Y-m-d', strtotime('+1 month')),
);

curl — Cancel a Subscription

curl -X POST https://secure.cyogate.net/api/transact.php   -d "security_key=YOUR_PRIVATE_KEY"   -d "recurring=delete_subscription"   -d "subscription_id=SUB-12345"

See also: Preparing Subscriptions | Vault Transactions

Query API

Retrieve transaction history, vault records, and subscription data.

Query Endpoint

https://secure.cyogate.net/api/query.php

Query Fields

FieldValue / FormatDescription
security_keystringYour Private API Key
report_typetransactionQuery transaction records
report_typecustomer_vaultQuery vault records
report_typerecurringQuery subscription plans
transaction_idstringLook up a single transaction by ID
customer_vault_idstringLook up a single vault record
start_dateYYYY-MM-DD HH:MM:SSFilter results from this datetime
end_dateYYYY-MM-DD HH:MM:SSFilter results to this datetime
result_limitintegerMaximum number of records to return
result_orderASC / DESCSort order by date

Code Examples

PHP — Query Last 30 Days of Transactions

$post = array(
    'security_key' => YOUR_PRIVATE_KEY,
    'report_type'  => 'transaction',
    'start_date'   => date('Y-m-d 00:00:00', strtotime('-30 days')),
    'end_date'     => date('Y-m-d 23:59:59'),
    'result_order' => 'DESC',
);
$ch = curl_init('https://secure.cyogate.net/api/query.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
$result = simplexml_load_string($xml);

Python — Look Up a Single Transaction

import requests

payload = {
    'security_key':   PRIVATE_KEY,
    'report_type':    'transaction',
    'transaction_id': 'TXN-12345678',
}
response = requests.post('https://secure.cyogate.net/api/query.php', data=payload)
# Response is XML — parse with xml.etree.ElementTree or xmltodict
Query API responses are returned as XML, not URL-encoded query strings. Parse with simplexml_load_string() in PHP or xml.etree.ElementTree in Python.

See also: Transaction History Component | Deposit History

Webhooks & Event Notifications

CyoGate POSTs a transaction notification to a URL you configure whenever a transaction is processed — including recurring billing charges, refunds, and voids. Configure your notification URL in the Merchant Control Panel under Settings > Transaction Notifications.

Notification POST Fields

FieldDescription
response1=Approved, 2=Declined, 3=Error
responsetextHuman-readable result message
transactionidUnique gateway transaction ID
amountAmount charged
authcodeCard network authorization code
avsresponseAVS result code
cvvresponseCVV result code
order_idYour order ID echoed back
customer_vault_idVault ID if customer was stored during this transaction
subscription_idSubscription ID for recurring billing notifications
typeTransaction type that triggered the notification
emailCustomer email echoed back if provided
firstname / lastnameCardholder name echoed back if provided

PHP Notification Handler

<?php
// Your configured notification_url endpoint
$response = $_POST['response'];
$txn_id   = $_POST['transactionid'];
$amount   = $_POST['amount'];
$order_id = $_POST['order_id'];

// Always validate amount and order_id match your records before fulfilling
if ($response == '1') {
    $order = get_order($order_id);
    if ($order && $order->amount == $amount && !$order->fulfilled) {
        fulfill_order($order_id, $txn_id);
    }
}
?>
Always validate that the transactionid, amount, and order_id in the notification match a pending order in your own database before fulfilling. This protects against forged notifications.

See also: Implement Backend | Hosted Checkout Advanced

Vault & Subscription Delete

Permanently remove Customer Vault records or cancel recurring subscriptions.

PHP — Delete Vault Record

$post = array(
    'security_key'      => YOUR_PRIVATE_KEY,
    'customer_vault'    => 'delete_customer',
    'customer_vault_id' => 'CUST-12345',
);

curl — Cancel Subscription

curl -X POST https://secure.cyogate.net/api/transact.php   -d "security_key=YOUR_PRIVATE_KEY"   -d "recurring=delete_subscription"   -d "subscription_id=SUB-12345"

Response

FieldDescription
response1=Success, 2=Failed, 3=Error
responsetextConfirmation or error message
Vault deletions and subscription cancellations are permanent and irreversible. Verify the correct customer_vault_id or subscription_id before executing.

See also: Managing Vault Entries | Credential on File Best Practices

Take Your Business to the Next Level

Find out how our innovative payment solutions can benefit your business. Reach out to us for more information or to get started!

Let's Get Started