sucrose 0.0.5 copy "sucrose: ^0.0.5" to clipboard
sucrose: ^0.0.5 copied to clipboard

A Bridge Payment Gateway for Xendit, Midtrans and any other payment gateway.

Sucrose #

A Bridge Payment Gateway for Xendit and any other payment gateway.

GitHub Repo Size Pub Version GitHub top language Codacy grade

Available Payment Gateway #

  • ✅ Xendit (WIP)
  • ✅ Midtrans (WIP)

Installation #

flutter pub add sucrose

Getting Started #

Init Xendit

import 'package:sucrose/sucrose.dart';
    
final sucrose = Sucrose.initXendit(xenditApiKey:"YOUR_API_KEY");

Init Midtrans

import 'package:sucrose/sucrose.dart';
    
final sucrose = Sucrose.initMidtrans(
    midtransApiKey: "YOUR_API_KEY",
    environment: MidtransEnvironment.SANDBOX,
    debug: true,
);

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: "hello@mail.com",
      items: [
        XenditInvoiceItem(
          name: "item 1",
          price: 10000,
          quantity: 1,
          category: "meow",
          url: "https://google.com",
        ),
      ],
    ),
  );

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: "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",
          ),
        ),
      ),
    );

Feedback #

If you have any feedback, please reach out to us at evnx32@gmail.com

2
likes
160
pub points
12%
popularity

Publisher

unverified uploader

A Bridge Payment Gateway for Xendit, Midtrans and any other payment gateway.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dio, flutter, logger

More

Packages that depend on sucrose