mp_flutter

Last updated:

0 purchases

mp_flutter Image
mp_flutter Images
Add to Cart

Description:

mp flutter

MercadoPago Flutter #
A Flutter package that mix the best of mercadopago_transparent and mercado_pago packages.
Note: this is a work in progress project.
For detailed docs about MercadoPago, please visit MercadoPago Developers Guides.
v0.1.0 #
Currently includes:

Document identification types available on MercadoPago.
New card token generation.
Card token generation for an already saved card.

Usage #
Initialize the package by generating a new MercadoPago instance:
import 'package:mp_flutter/mp_flutter.dart';

MercadoCredentials mercadoCredentials = MercadoCredentials(accessToken: 'ACESS_TOKEN');

final mercadoPago = MercadoPago(mercadoCredentials);
copied to clipboard
Document Types #

To get a list of identification types available on MercadoPago

List<DocumentType>? documentTypes = <DocumentType>[];

await mercadoPago.services.documentTypes()
.then((obj) {
if (obj.isSuccessful) {
documentTypes = (json.decode(obj.data) as List)
.map((dt) => DocumentType.fromJson(dt))
.toList();
}
});
copied to clipboard
Generate new card token #

To generate a new card token use the newCard function.

Note: To get more details about payment types, id, etc, visit: MercadoPago payment methods docs.
CardToken cardToken;

await mercadoPago.services.newCard(
code: '123',
year: '2025',
month: 11,
cardNumber: '4509953566233704',
documentNumber: '12345678',
documentType: 'DNI',
fullName: 'APRO'
).then((obj) {
if (obj.isSuccessful) {
cardToken = CardToken.fromJson(obj.data);
}
});
copied to clipboard
Token with Card #

Generate a token from a card already saved

CardSavedToken cardSavedToken;

await mercadoPago.services.tokenWithCard(
cardId: '1587964933876',
securityCode: '333'
).then((obj) {
if (obj.isSuccessful) {
cardSavedToken = CardSavedToken.fromJson(obj.data);
}
});
copied to clipboard
Contributions #
Please, feel free to open an Issue if you found any bugs or submit a PR.
License #
mp_flutter is licensed under MIT.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.