0 purchases
sucrose
Sucrose #
A Bridge Payment Gateway for Xendit and any other payment gateway.
Available Payment Gateway #
✅ Xendit (WIP)
✅ Midtrans (WIP)
Installation #
flutter pub add sucrose
copied to clipboard
Getting Started #
Init Xendit
import 'package:sucrose/sucrose.dart';
final sucrose = Sucrose.initXendit(xenditApiKey:"YOUR_API_KEY");
copied to clipboard
Init Midtrans
import 'package:sucrose/sucrose.dart';
final sucrose = Sucrose.initMidtrans(
midtransApiKey: "YOUR_API_KEY",
environment: MidtransEnvironment.SANDBOX,
debug: true,
);
copied to clipboard
Get Started with Xendit #
Create Invoice
final response = await sucrose.xendit.createInvoice(
request: XenditInvoiceRequest(
externalId: "ref 13123213",
amount: 10000,
description: "your description goes here",
payerEmail: "[email protected]",
items: [
XenditInvoiceItem(
name: "item 1",
price: 10000,
quantity: 1,
category: "meow",
url: "https://google.com",
),
],
),
);
copied to clipboard
Get Started with Midtrans #
Create Snap Transaction
final response = await sucrose.midtrans.createSnapTransaction(
request: MidtransSnapTransactionRequest(
transactionDetails: MidtransTransactionDetail(
orderId: "Inv-${DateTime.now().millisecondsSinceEpoch}",
grossAmount: 12500,
),
itemDetails: [
MidtransItemDetail(
id: "021930129031",
name: "Steam Wallet IDR 12K",
price: 12500,
quantity: 1,
),
],
customerDetails: MidtransCustomerDetails(
email: "[email protected]",
firstName: "Test",
lastName: "Test",
phone: "08123456789",
shippingAddress: MidtransShippingAddress(
address: "Jalan Teknologi Indonesia",
city: "Jakarta",
countryCode: "IDN",
firstName: "Test",
lastName: "Test",
phone: "08123456789",
postalCode: "12345",
),
billingAddress: MidtransBillingAddress(
address: "Jalan Teknologi Indonesia",
city: "Jakarta",
countryCode: "IDN",
firstName: "Test",
lastName: "Test",
phone: "08123456789",
postalCode: "12345",
),
),
),
);
copied to clipboard
Feedback #
If you have any feedback, please reach out to us at [email protected]
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.