daravel_payments
English ยท Bahasa Indonesia
Payments for Daravel through Midtrans, Xendit and Stripe, behind one API. A paid notification is applied once, from the gateway only, for the amount ordered.
dart pub add daravel_payments
Application createApp() => Application.configure(basePath: '.')
.withPayments() // POST /payments/webhook/{gateway}
.withMigrations(const [CreatePaymentTables()])
// ...
.create();
final checkout = await Payment.checkout(
const PaymentRequest(orderId: 'ORDER-42', amount: 150000),
);
// checkout.redirectUrl: the gateway's payment page
events.listen<PaymentPaid>((paid) => fulfil(paid.payment.orderId));
- Midtrans Snap (QRIS, virtual accounts, e-wallets, cards); notifications
checked with
SHA512(order_id + status_code + gross_amount + server key). - Xendit invoices; callbacks checked with the
x-callback-token. - Stripe Checkout; webhooks checked with the
v1HMAC-SHA256 of the timestamped body, five minutes of tolerance. - Exactly once: an idempotency log keyed on the notification, the payment
row locked, the amount compared with the order's, status moves that only
go forward (a late
pendingnever undoespaid), events after commit. Payment.fake()for tests,dartisan payment:check <order>for a missed webhook.
Documentation: github.com/daravel-dev/daravel/blob/main/docs/guide/payments.md.
License and trademarks
MIT. "Laravel" is a trademark of Laravel Holdings Inc.; "Dart" is a trademark of Google LLC. Midtrans, Xendit and Stripe are trademarks of their owners. Daravel is an independent project, not affiliated with or endorsed by any of them.
Libraries
- commands
- The
payment:checkcommand, forbootstrap/commands.dart: - daravel_payments
- Payments for Daravel (Blueprint #40): Midtrans (Snap), Xendit (invoices) and Stripe (Checkout) behind one API, with webhooks verified and applied exactly once, amounts checked, and events after commit.