fersaku/fersaku-php
Composer 安装命令:
composer require fersaku/fersaku-php
包简介
Official Fersaku QRIS Payment Gateway SDK for PHP
README 文档
README
Official PHP SDK untuk Fersaku QRIS Payment Gateway.
Instalasi
composer require fersaku/fersaku-php
Atau copy folder src/ langsung ke project Anda.
Quick Start
<?php require_once 'vendor/autoload.php'; use Fersaku\Fersaku; $fersaku = new Fersaku('sk_live_your_secret_key'); // Buat pembayaran $payment = $fersaku->createPayment([ 'amount' => 50000, 'customer_name' => 'John Doe', 'customer_email' => 'john@example.com', 'description' => 'Pembelian Produk A', 'external_id' => 'order-123', 'expired_minutes' => 30, ]); echo $payment['checkout_url']; // Redirect customer ke sini echo $payment['qr_string']; // Atau tampilkan QR langsung
API Methods
createPayment(array $params)
Buat pembayaran QRIS baru.
$payment = $fersaku->createPayment([ 'amount' => 100000, // Wajib, min 1000 'customer_name' => 'Budi', // Opsional 'customer_email' => 'budi@email.com', // Opsional 'description' => 'Order #123', // Opsional 'external_id' => 'my-order-123', // Opsional 'expired_minutes' => 30, // Opsional, default 30 ]);
getPayment(string $id)
Ambil detail pembayaran.
$detail = $fersaku->getPayment('payment_id_here');
listPayments(array $params)
List pembayaran dengan filter.
$list = $fersaku->listPayments(['status' => 'paid', 'limit' => 10]);
cancelPayment(string $id)
Batalkan pembayaran pending.
$fersaku->cancelPayment('payment_id_here');
checkStatus(string $id)
Cek status terbaru.
$result = $fersaku->checkStatus('payment_id_here');
simulate(string $paymentId, string $action) (Sandbox only)
Simulasi pembayaran di sandbox.
$sandbox = new Fersaku('sk_test_your_sandbox_key'); $sandbox->simulate('payment_id', 'pay'); // pay, expire, fail, cancel
Webhook Verification
<?php use Fersaku\Fersaku; // Laravel Controller public function handleWebhook(Request $request) { $signature = $request->header('X-Webhook-Signature'); $webhookSecret = env('FERSAKU_WEBHOOK_SECRET'); $isValid = Fersaku::verifyWebhook( $request->all(), $signature, $webhookSecret ); if (!$isValid) { return response()->json(['message' => 'Unauthorized'], 401); } $event = $request->input('event'); $paymentId = $request->input('payment_id'); $orderId = $request->input('order_id'); $status = $request->input('status'); $amount = $request->input('amount'); if ($event === 'payment.paid') { // Proses pembayaran berhasil // Update order di database Anda } return response()->json(['message' => 'OK']); }
Native PHP (tanpa framework)
<?php require_once 'src/Fersaku.php'; use Fersaku\Fersaku; $payload = json_decode(file_get_contents('php://input'), true); $signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? ''; $webhookSecret = 'whsec_your_secret_here'; if (!Fersaku::verifyWebhook($payload, $signature, $webhookSecret)) { http_response_code(401); echo json_encode(['message' => 'Unauthorized']); exit; } if ($payload['event'] === 'payment.paid') { // Proses pembayaran berhasil } http_response_code(200); echo json_encode(['message' => 'OK']);
Sandbox vs Production
// Production $live = new Fersaku('sk_live_xxx'); // Sandbox (testing) $sandbox = new Fersaku('sk_test_xxx');
Error Handling
use Fersaku\Fersaku; use Fersaku\FersakuException; try { $payment = $fersaku->createPayment(['amount' => 500]); } catch (FersakuException $e) { echo $e->getMessage(); // "Amount must be at least Rp 1.000" echo $e->getCode(); // 400 print_r($e->getData()); // Full error response }
License
MIT
fersaku/fersaku-php 适用场景与选型建议
fersaku/fersaku-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fersaku/fersaku-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fersaku/fersaku-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-12