A Bridge Payment Gateway for Xendit and any other payment gateway.
- Xendit (WIP)
- Midtrans (WIP)
flutter pub add sucrose
import 'package:sucrose/sucrose.dart';
final sucrose = Sucrose.initXendit(xenditApiKey:"YOUR_API_KEY");
import 'package:sucrose/sucrose.dart';
final sucrose = Sucrose.initMidtrans(
midtransApiKey: "YOUR_API_KEY",
environment: MidtransEnvironment.SANDBOX,
debug: true,
);
final response = await sucrose.xendit.createInvoice(
request: XenditInvoiceRequest(
externalId: "ref 13123213",
amount: 10000,
description: "your description goes here",
payerEmail: "hello@mail.com",
items: [
XenditInvoiceItem(
name: "item 1",
price: 10000,
quantity: 1,
category: "meow",
url: "https://google.com",
),
],
),
);
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: "test@mail.com",
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",
),
),
),
);
If you have any feedback, please reach out to us at evnx32@gmail.com