Dorve PayDocs Mulai terima pembayaran
Beranda  /  Dokumentasi  /  SDK PHP

SDK PHP

SDK PHP Dorve Pay adalah satu file DorvePay.php tanpa dependensi, cukup ekstensi curl. Cocok untuk toko PHP native, Laravel, CodeIgniter, atau WordPress kustom.

Unduh DorvePay.php PHP ≥ 8.0 · MIT

Pemasangan

php
require __DIR__.'/lib/DorvePay.php';
$dp = new DorvePay(getenv('DORVEPAY_KEY'));   // base URL default: https://api.dorve-pay.com

Metode

MetodeEndpointMengembalikan
ping()GET /v1/ping['ok'=>true,'outlet'=>..,'qris_configured'=>..]
createInvoice(int $amount, array $opt = [])POST /v1/invoicesobjek tagihan (lihat referensi)
getInvoice(string $id)GET /v1/invoices/{{id}}objek tagihan
cancelInvoice(string $id)POST /v1/invoices/{{id}}/cancelobjek tagihan
balance()GET /v1/balancesaldo
DorvePay::verifyWebhook(string $raw, string $sig, string $secret)—array event, atau null bila tanda tangan salah

Contoh lengkap

php
<?php
require 'DorvePay.php';
$dp = new DorvePay(getenv('DORVEPAY_KEY'));

try {
    $inv = $dp->createInvoice(250000, ['ext_ref' => 'ORDER-77', 'customer' => ['name' => 'Sari']]);
    header('Location: ' . $inv['checkout_url']); exit;
} catch (RuntimeException $e) {
    // "DorvePay 422: Nominal minimum Rp1.000", "DorvePay 429: ...", dst.
    error_log($e->getMessage()); echo 'Pembayaran sedang tidak tersedia, coba lagi.';
}

Laravel / framework lain

Daftarkan sebagai singleton di service container dan baca kunci dari config/services.php. Untuk route webhook, matikan verifikasi CSRF pada path tersebut dan baca body mentah dengan $request->getContent().

Bahasa lain

API-nya REST biasa; contoh verifikasi webhook untuk Python dan Node ada di halaman Webhook. SDK resmi untuk bahasa lain belum tersedia.

Terakhir diperbarui 2026-11-14. Ada yang kurang jelas? Tanya tim teknis via WhatsApp.