Skip to main content

Flutter

Learn how to install and configure our Flutter SDK to use Efí's APIs

Attention!

Requests made to Efí's APIs using the Flutter SDK require the certificate generated in your Efí account in .p12 format.


Installing

To use this plugin, add efipay as a dependency in your pubspec.yaml file to use Efí Pay's SDK.


Tested with

Dart 2.12.3


Basic Usage

import 'package:efipay/efipay.dart';

class _PaymentPageState extends State<PaymentPage> {
var config = {
'client_id': 'YOUR_CLIENT_ID',
'client_secret': 'YOU_CLIENT_SECRET',
'account_id': ''
'sandbox': false,
'certificate': '',
};
EfiPay efipay;

@override
void initState() {
this.efipay = Efipay(config);
}

}

Examples

Example of how to create a charge:

void createCharge(){
EfiPay efi = EfiPay(config);
dynamic body = {
'items': [
{'name': "Product 1", 'value': 1100, 'amount': 2}
],
};
return await efi.call('createCharge', body: body);
}

All examples available in our SDK can be found in our Github repository at Efí.

Then, execute the command:

flutter pub get