Dokumentasi API
OMNI Telkomsel
REST API gateway untuk mengambil daftar produk Telkomsel dan memproses kode pembayaran secara otomatis melalui kanal OMNI O2O. Semua endpoint mengembalikan response dalam format JSON.
๐ Base URL
Semua request dikirim ke base URL berikut:
https://omni.astipay.co.id
๐ Autentikasi
Setiap request ke endpoint yang dilindungi wajib menyertakan header X-Api-Key.
8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99
Format Header
X-Api-Key: 8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99 Origin: https://domainanda.com
๐ก Endpoints
API ini menyediakan 3 endpoint utama.
Mengecek status layanan API. Untuk monitoring uptime. Tidak memerlukan API Key.
Request
curl https://omni.astipay.co.id/api/omni/health
Response (200 OK)
{
"status": true,
"service": "OMNI Telkomsel Gateway API",
"uptime": 3482.51,
"timestamp": "2025-01-15T10:00:00.000Z"
}
Mengambil daftar kategori dan paket produk Telkomsel yang eligible untuk nomor MSISDN tertentu secara real-time dari sistem OMNI.
Query Parameters
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
| msisdn | string | Wajib | Nomor handphone Telkomsel (format: 08xxxxxxxxxx atau 628xxxxxxxxxx) |
| campaign | string | Opsional | Kode campaign OMNI. Default: omni-outlet |
Contoh Request
curl -X GET "https://omni.astipay.co.id/api/omni/products?msisdn=082151701723" \ -H "X-Api-Key: 8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99"
const res = await fetch( 'https://omni.astipay.co.id/api/omni/products?msisdn=082151701723', { headers: { 'X-Api-Key': '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99' } } ); const data = await res.json();
$ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => 'https://omni.astipay.co.id/api/omni/products?msisdn=082151701723', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['X-Api-Key: 8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99'], ]); $data = json_decode(curl_exec($ch), true); curl_close($ch);
import requests data = requests.get( 'https://omni.astipay.co.id/api/omni/products', headers={'X-Api-Key': '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99'}, params={'msisdn': '082151701723'} ).json()
Response (200 OK)
{
"status": true,
"msisdn": "082151701723",
"categories": [
{
"label": "Internet",
"slug": "internet",
"productsCount": 12,
"products": [
{
"packageId": "PKG-001",
"name": "Paket NONSTOP 1GB",
"quota": "1 GB",
"validity": "7 Hari",
"price": 15000,
"displayPrice": "Rp 15.000",
"category": "Internet"
}
]
}
],
"executionTimeMs": 3241
}
Memproses pemilihan paket dan mengembalikan Kode Pembayaran dari OMNI Telkomsel. Kode ini ditunjukkan ke kasir outlet untuk menyelesaikan transaksi.
Request Body (JSON)
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
| msisdn | string | Wajib | Nomor handphone Telkomsel |
| packageId | string | Wajib | ID paket dari endpoint /products |
| price | number | Opsional | Harga paket dalam Rupiah (integer) |
| withVoucher | boolean | Opsional | Gunakan voucher jika tersedia. Default: false |
| campaign | string | Opsional | Kode campaign. Default: omni-outlet |
Contoh Request
curl -X POST "https://omni.astipay.co.id/api/omni/checkout" \ -H "Content-Type: application/json" \ -H "X-Api-Key: 8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99" \ -d '{"msisdn":"082151701723","packageId":"PKG-001","price":15000}'
const res = await fetch('https://omni.astipay.co.id/api/omni/checkout', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Api-Key': '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99' }, body: JSON.stringify({ msisdn: '082151701723', packageId: 'PKG-001', price: 15000 }) }); const data = await res.json(); console.log(data.paymentCode);
$payload = json_encode(['msisdn'=>'082151701723', 'packageId'=>'PKG-001', 'price'=>15000]); $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => 'https://omni.astipay.co.id/api/omni/checkout', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-Api-Key: 8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99', ], ]); $data = json_decode(curl_exec($ch), true); curl_close($ch); echo $data['paymentCode'];
import requests data = requests.post( 'https://omni.astipay.co.id/api/omni/checkout', headers={'X-Api-Key': '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99'}, json={'msisdn': '082151701723', 'packageId': 'PKG-001', 'price': 15000} ).json() print(data['paymentCode'])
Response (200 OK)
{
"status": true,
"paymentCode": "1234567890",
"msisdn": "082151701723",
"packageId": "PKG-001",
"executionTimeMs": 5832
}
โ ๏ธ Kode Error
Semua response error memiliki format { "status": false, "message": "..." }.
| HTTP Status | Keterangan | Solusi |
|---|---|---|
| 200 OK | Request berhasil | โ |
| 400 Bad Request | Parameter wajib tidak disertakan (msisdn kosong) |
Periksa kelengkapan parameter / body |
| 403 Forbidden | API Key tidak valid atau tidak disertakan | Pastikan header X-Api-Key ada dan benar
|
| 500 Internal Error | Gagal mengambil data dari OMNI Telkomsel | Coba ulangi beberapa saat. Periksa log server |
๐ก Contoh Alur Integrasi
Alur lengkap: ambil produk lalu checkout dalam satu fungsi.
const API_KEY = '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99'; const BASE = 'https://omni.astipay.co.id'; async function beliPaket(msisdn) { // 1. Ambil produk const prodRes = await fetch(`${BASE}/api/omni/products?msisdn=${msisdn}`, { headers: { 'X-Api-Key': API_KEY } }); const produk = await prodRes.json(); if (!produk.status) throw new Error(produk.message); // 2. Pilih paket pertama const paket = produk.categories[0].products[0]; // 3. Checkout const coRes = await fetch(`${BASE}/api/omni/checkout`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Api-Key': API_KEY }, body: JSON.stringify({ msisdn, packageId: paket.packageId, price: paket.price }) }); const result = await coRes.json(); if (!result.status) throw new Error(result.message); return result.paymentCode; } beliPaket('082151701723').then(kode => console.log('Kode:', kode));
define('API_KEY', '8b3e494ee5f170835b4cba1b6e7c2f50817575c301e64fa9bdc4bfa292c03e99'); define('BASE_URL', 'https://omni.astipay.co.id'); function omniRequest($method, $path, $body = null) { $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => BASE_URL . $path, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-Api-Key: ' . API_KEY, ], ]); if ($method === 'POST') { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); } $res = json_decode(curl_exec($ch), true); curl_close($ch); return $res; } $msisdn = '082151701723'; $produk = omniRequest('GET', '/api/omni/products?msisdn=' . $msisdn); $paket = $produk['categories'][0]['products'][0]; $result = omniRequest('POST', '/api/omni/checkout', [ 'msisdn' => $msisdn, 'packageId' => $paket['packageId'], 'price' => $paket['price'], ]); echo 'Kode Pembayaran: ' . $result['paymentCode'];
OMNI Telkomsel Gateway ยท astipay.co.id ยท โ Kembali ke Playground