API Documentation

Integrasikan payment gateway QRIS ke aplikasi Anda dengan mudah menggunakan REST API kami. Semua endpoint menggunakan format JSON.

Base URL

https://pay.danapeduli.com/api

Authentication

Semua request memerlukan API Key yang bisa didapatkan dari halaman API Keys di dashboard. Kirim API Key melalui parameter POST atau JSON body.

Example header:

{
    "api_key": "your_api_key_here"
}

Endpoints

POST

/create.php

Membuat invoice baru dan generate QRIS pembayaran.

Request Body

{
    "api_key": "your_api_key",
    "nominal": 10000,
    "callback_url": "https://yourapp.com/webhook"
}

Parameter

Parameter Type Req Description
api_key string Yes API Key anda
nominal integer Yes Min 1000
callback_url string No Webhook URL

Success Response

{
    "invoice": "INV202502181234",
    "qr_string": "000201010211...",
    "qr_image": "https://api.qrserver.com/v1/create-qr-code/?data=...",
    "expired": "2025-02-18 14:30:00"
}

Error Response

{
    "error": "Invalid API Key"
}
GET

/status.php

Cek status pembayaran invoice.

Query Parameters

Parameter Type Req Description
invoice string Yes Nomor invoice

Example Request

GET https://pay.danapeduli.com/api/status.php?invoice=INV202502181234

Success Response

{
    "invoice": "INV202502181234",
    "status": "paid",
    "amount": 10000,
    "paid_at": "2025-02-18 14:25:00"
}

Webhook

Saat pembayaran berhasil dikonfirmasi, kami akan mengirimkan notifikasi ke callback_url yang anda daftarkan.

Webhook Payload

{
    "invoice": "INV202502181234",
    "status": "paid",
    "amount": 10000,
    "paid_at": "2025-02-18 14:25:00"
}

Important Notes

  • Webhook dikirim dengan method POST
  • Content-Type: application/json
  • Server harus merespon status 200
  • Retry 3x jika gagal

Error Codes

Code Description
400 Bad Request
401 Unauthorized
404 Not Found
429 Too Many Requests
500 Internal Error

Code Examples

PHP

<?php
$api_key = 'your_api_key';
$nominal = 10000;

$ch = curl_init('https://pay.danapeduli.com/api/create.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'api_key' => $api_key,
    'nominal' => $nominal
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);

echo 'Invoice: ' . $data['invoice'];
?>

JavaScript

fetch('https://pay.danapeduli.com/api/create.php', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        api_key: 'your_api_key',
        nominal: 10000
    })
})
.then(response => response.json())
.then(data => {
    console.log('Invoice:', data.invoice);
    console.log('QR Image:', data.qr_image);
});

Python

import requests
import json

url = 'https://pay.danapeduli.com/api/create.php'
data = {
    'api_key': 'your_api_key',
    'nominal': 10000
}

response = requests.post(url, json=data)
result = response.json()

print(f"Invoice: {result['invoice']}")

cURL

curl -X POST https://pay.danapeduli.com/api/create.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key",
    "nominal": 10000
  }'

Rate Limits

100 requests/menit per API Key

1000 requests/jam per API Key

Response 429 jika melebihi limit