SanPay NeoPay API Docs
Kembali ke Dashboard

Pengenalan API

Selamat datang di dokumentasi resmi NeoPay API. Gunakan API ini untuk menerima pembayaran dari pelanggan langsung di dalam website atau aplikasi buatan Anda.

Base URL API: https://pay.sanpay.id/openapi.php

Autentikasi

Setiap panggilan API harus menyertakan header X-API-KEY. Anda bisa mendapatkan API Key ini dari menu Developer API di Dashboard Mitra Anda.

HEADERS
{
    "Content-Type": "application/json",
    "X-API-KEY": "sk_live_123abc456def..."
}

Create Invoice (Membuat Tagihan)

Digunakan untuk men-generate kode pembayaran (VA, QRIS, Retail).

POST/openapi.php?action=create_invoice

Body JSON:

{
    "amount": 50000,
    "method": "BCA", 
    "type": "va", 
    "mitra_reference": "INV-12345",
    "customer_name": "John Doe",
    "customer_email": "john@doe.com"
}

* type: Pilih salah satu: qris, va, atau retail.
* method: Contoh: BCA, MANDIRI, ALFAMART, QRIS.

Response (Sukses):

{
    "status": "success",
    "message": "Invoice created successfully",
    "data": {
        "sanpay_reference": "API-170000123",
        "mitra_reference": "INV-12345",
        "type": "va",
        "method": "BCA",
        "total_amount": 54000,
        "payment_code": "0987654321",
        "status": "UNPAID"
    }
}

Check Status

GET/openapi.php?action=check_status&reference={mitra_reference}

Mengecek status pembayaran (PAID / UNPAID).

Webhook / Callback

Ketika pelanggan berhasil membayar, NeoPay akan mengirimkan HTTP POST otomatis (Webhook) ke URL website Anda.

Format Payload Webhook (JSON):

{
    "status": "PAID",
    "mitra_reference": "INV-12345",
    "sanpay_reference": "API-170000123",
    "amount": 50000,
    "total_amount": 54000
}

Website Anda wajib merespon dengan HTTP Status 200 OK saat menerima webhook ini.