Skip to main content

For Flutter & Dart Devs

To get started integrating payments into LUNC/LUNA for your on-chain products, please use the following pub package.

About the Library

Internally manages gas estimation required by the burn tax for successful transactions on the blockchain. Makes it easier for devs to get started with payments on the LUNC/LUNA Blockchains.

Features

  • Written in Dart, with type definitions
  • Works with the Flutter & Dart Ecosystems, in the browser, and Mobile solutions for anyone building on the Terra Ecosystem
  • Makes it easier to manage payments for anyone deploying to the app store

Installation & Configuration

Grab the latest version off Pub


_1
dart pub add terra_dart_onchain_payments

Usage

This package can be used for Mobile & Web Developers, or SDK Developers looking to extend the Terra Platform

Manage Payments


_16
_16
void verifyCustomerBalance() {
_16
// Recovery Words of the Customer wallet that will be making the payment
_16
String customerRecoveryWords = "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
_16
_16
// Configure your PaymentManager
_16
// Set Blockchain to target (in this case Classic)
_16
var paymentsManager = PaymentsManager()
_16
.configureBlockchain(env: TerraEnvironment.classic)
_16
.configureBusinessWallet(
_16
businessWallet) // Configure your Business Wallet
_16
.configureCustomerWallet(
_16
customerRecoveryWords); // Configure the Customer Wallet
_16
_16
var simulation = await paymentsManager.getTotalFundsInCustomerWallet();
_16
}


_19
void processPaymentForTerra() {
_19
// Wallet where customer payments will be transferred to
_19
String businessWallet = "terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp";
_19
_19
// Recovery Words of the Customer wallet that will be making the payment
_19
String customerRecoveryWords = "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius";
_19
_19
// Configure your PaymentManager
_19
// Set Blockchain to target (in this case Classic)
_19
var paymentsManager = PaymentsManager()
_19
.configureBlockchain(env: TerraEnvironment.classic)
_19
.configureBusinessWallet(
_19
businessWallet) // Configure your Business Wallet
_19
.configureCustomerWallet(
_19
customerRecoveryWords); // Configure the Customer Wallet
_19
_19
// Customer is charged 100 LUNC
_19
var transaction = await paymentsManager.chargeCustomer(100);
_19
}