# SikatPay API > SikatPay (https://payment.sikatpinoy.net) is a payment gateway for the Philippines: merchants accept QR Ph, GCash and Maya through a hosted, branded checkout page. Your server creates a payment with one API call, redirects the customer to `checkout_url`, and receives a signed `payment.paid` webhook. Operated by Bonggot Tech. Machine-readable spec: https://payment.sikatpinoy.net/openapi.json · Human docs: https://payment.sikatpinoy.net/docs ## Rules an integration MUST follow 1. Call the API only from your server. API keys (`mk_…` live, `mk_test_…` test) must never be in browser JavaScript or a mobile app. 2. Keep prices on your server. The client sends an item/plan key; your server looks up the amount. Never accept an amount from the client. 3. Grant goods ONLY in the webhook handler, never on the success/return page (a customer can open it by hand). 4. In the webhook: verify the signature with the RAW body, then in one database transaction: find the order by `data.order_id`, return 200 if it is already paid, require `data.amount == order.total`, mark it paid, grant once. 5. Always send an `order_id`. It makes checkout creation idempotent (see below). 6. Build and test with the test key first; switch to the live key only after an end-to-end test passes. 7. Amounts are integer centavos: PHP 150.00 = 15000. ## Authentication `Authorization: Bearer ` on every request. Base URL: `https://payment.sikatpinoy.net/api/v1`. JSON in and out. Rate limit: 600 requests/minute per key. - Live key `mk_<48 hex>`: real payments; available after the merchant account is approved. - Test key `mk_test_<48 hex>`: simulated payments, no money moves; works while the account is pending. A test key cannot read live payments and vice versa. ## Create a payment — POST /payments Request body: - `amount` (integer, required): centavos. Default range 2000–5000000 (PHP 20–50,000). - `order_id` (string, strongly recommended): your order reference, max 100 chars, `[A-Za-z0-9 _ - . : # /]`. - `description` (string, optional): shown to the customer, max 200 chars. Keep it neutral ("200 credits", "Order 1024"). - `success_url`, `cancel_url` (string, optional): https URLs to return the customer to. Include your own order reference in them. Responses: - `201` new payment → Payment object. Redirect the customer to `checkout_url`. - `200` with `"reused": true` → a pending payment with the same `order_id` and amount already exists; the SAME payment is returned (double-click safe). - `409 order_already_paid` → this order_id is already paid. Do not charge again. - `409 order_pending_different_amount` → a pending payment for this order_id has another amount; wait 1 hour or use a new order_id. A payment link expires 1 hour after creation; after that the same order_id creates a fresh payment. ## Retrieve a payment — GET /payments/{id} Returns the Payment object. Use it to double-check before shipping or after a missed webhook. ## Payment object `id` (string, 20 chars), `livemode` (bool), `status` (`pending` | `paid` | `expired` | `review`), `amount` (int centavos), `currency` ("PHP"), `order_id`, `description`, `method` (`qrph` | `gcash` | `paymaya` | null), `platform_fee` (int, when paid), `net_amount` (int, when paid), `checkout_url`, `created_at`, `paid_at`, `expires_at` (ISO 8601). `review` = paid amount or reference did not match; the merchant is contacted — do not fulfil automatically. ## Errors Body: `{ "error": { "code": "...", "message": "..." } }` - 400 `invalid_amount`, `invalid_request` — fix the input. - 401 `unauthorized` — missing/invalid key. - 403 `merchant_inactive` — account pending (live key), frozen, banned or rejected. - 403 `policy_violation` — a prohibited term in description/order_id/URLs; the account is frozen. - 404 `not_found`. - 409 `order_already_paid`, `order_pending_different_amount`. - 429 `daily_limit`, `daily_create_limit`, `rate_limited`. - 500 `server_error` — retry with exponential backoff. ## Webhooks Configure URLs in Dashboard → Developers (each has its own signing secret `whsec_…` and a "Receives" setting: live only, test only, or live + test). Event body: ```json { "id": "evt_…", "type": "payment.paid", "livemode": true, "created": 1790000000, "data": { /* Payment object */ } } ``` Headers: `X-Signature: t=,v1=`, `X-Event-Id`, `Content-Type: application/json`, `User-Agent: PaymentGateway-Webhook/1.0`. Event types: `payment.paid`; `ping` (dashboard test). Respond 200 to unknown types. Signature: `v1 = hex(HMAC_SHA256(signing_secret, t + "." + raw_body))`. Compare in constant time; reject if |now − t| > 300 seconds. Delivery: respond 2xx within 8 seconds. Retries after 5 s, 10 s, 30 s, 1, 5, 15, 30 min, 1, 3, 6, 12, 24 h — with the SAME event id, so handlers must be idempotent. Test-mode events have `livemode: false`; never fulfil them in production. ### Node.js (Express) verification ```js app.post('/webhooks/sikatpay', express.raw({ type: 'application/json' }), (req, res) => { const { t, v1 } = Object.fromEntries(String(req.get('X-Signature') || '').split(',').map((p) => p.split('='))); const expected = crypto.createHmac('sha256', process.env.SIKATPAY_WEBHOOK_SECRET).update(`${t}.${req.body}`).digest('hex'); const ok = v1 && v1.length === expected.length && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected)) && Math.abs(Date.now() / 1000 - Number(t)) <= 300; if (!ok) return res.status(401).end(); const event = JSON.parse(req.body); if (event.type === 'payment.paid' && event.livemode) fulfilOnce(event.data); // idempotent, checks amount res.sendStatus(200); }); ``` ### PHP verification ```php $raw = file_get_contents('php://input'); parse_str(str_replace(',', '&', $_SERVER['HTTP_X_SIGNATURE'] ?? ''), $sig); $expected = hash_hmac('sha256', ($sig['t'] ?? '') . '.' . $raw, getenv('SIKATPAY_WEBHOOK_SECRET')); if (empty($sig['v1']) || !hash_equals($expected, $sig['v1']) || abs(time() - (int) $sig['t']) > 300) { http_response_code(401); exit; } $event = json_decode($raw, true); if ($event['type'] === 'payment.paid' && $event['livemode']) { fulfil_once($event['data']); } // idempotent, checks amount http_response_code(200); ``` ## Test mode Use a `mk_test_` key with the same endpoints. The checkout page for a test payment shows "Simulate successful / failed / expired" instead of a QR code. "Successful" sends a real signed `payment.paid` with `livemode: false`. Test payments never affect balances, payouts or limits. The dashboard also has "Create test payment" and "Send test event" (ping or sample payment.paid with `order_id` `SAMPLE-ORDER-…`), and a Deliveries log per webhook. ## Status SikatPay is in beta with a limited number of approved merchants; features, fees and limits may change. It is operated by Bonggot Tech (a registered Philippine business), is not a bank or e-money issuer and holds no BSP license itself — payments are processed by a licensed payment processor. ## Customer-facing notes - GCash, Maya and bank apps show the recipient as "PMP BONGGOT TECH" (the company that operates SikatPay); the checkout page explains this before payment. - Methods: QR Ph (any bank or e-wallet app), GCash, Maya. No cards, no refunds API, no subscriptions API — sell renewals as new payments. ## Optional - Acceptable use: gambling, lending/investment schemes, crypto/forex, adult content, drugs, counterfeit goods and impersonation are prohibited; matching accounts are frozen automatically. https://payment.sikatpinoy.net/terms#prohibited - Security contact: https://payment.sikatpinoy.net/.well-known/security.txt