bmkeros / mercadopago_sdk_dart Goto Github PK
View Code? Open in Web Editor NEWMercadoPago Dart SDK
License: MIT License
MercadoPago Dart SDK
License: MIT License
According MercadoPago documentation to generate a preference, you need a Public Key and Access Token and not a Client Id and Client Secret.
I tried to get preference sending using de constructor MP('public_key','access_token') but didn't work, so i suppose that the Client id is not the same as Public Key and Client Secret is not the same as Access Token.
Is this plugin ready for iOS? it says so in pub.dev, but I dont see any way it can be implemented.
Thanks.
Hello, how can I create a payment?
Im trying to get users or pay method and I have this error:
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The getter 'keys' was called on null.
Receiver: null
Tried calling: keys
If a try by the URL by web i receive the information.
The caller is:
mp.get("/v1/payment_methods", authenticate: true, params: {});
Thanks!
Can you tell me if with this api i can create a pending payment to be released in X days?
I need to meet two scenarios:
Hello BMKeros,
Is it possible to use a recurring payment with this api?
Thank you,
Elaine
Those secret credentials should be used on the server side.
anyone can access to this sensitive data if decompile the apk
Como ya lo han reportado, el "quemar" tanto el client id como el client secret y el access token es una brecha de seguridad gigante por lo que no es recomendado el uso de este plugin mientras no haya manera de cifrar esas credenciales.
Because mercadopago_sdk 1.2.0 depends on http ^0.12.0 and no versions of mercadopago_sdk match >1.2.0 <2.0.0, mercadopago_sdk ^1.2.0 requires http ^0.12.0.
So, because .... depends on both http ^0.13.0 and mercadopago_sdk ^1.2.0, version solving failed.
hello!
I'm having some problems trying to implement the funcionality "getpreference"
It lead's me to an error message.
the code is:
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mood/classes.dart';
import 'package:mood/style/components/textFieldFormularios.dart';
import 'package:mood/style/fonts.dart';
import 'package:flutter_google_pay/flutter_google_pay.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class CartaoPage extends StatefulWidget {
CartaoPage(this.mediaHeight, this.mediaWidth, {Key key})
: super(key: key);
final double mediaHeight;
final double mediaWidth;
@OverRide
CartaoPageState createState() => new CartaoPageState();
}
class CartaoPageState extends State {
@OverRide
void initState() {
super.initState();
}
@OverRide
Widget build(BuildContext context) {
MercadoPago mercadoInstance = new MercadoPago();
_makeCustomPayment() async {
var environment = 'rest'; // or 'production'
if (!(await FlutterGooglePay.isAvailable(environment))) {
print('Google pay not available');
} else {
///docs https://developers.google.com/pay/api/android/guides/tutorial
PaymentBuilder pb = PaymentBuilder()
..addGateway( "PAYMENT_GATEWAY","3359798608018742195")
..addTransactionInfo("1.0", "USD")
..addAllowedCardAuthMethods(["PAN_ONLY", "CRYPTOGRAM_3DS"])
..addAllowedCardNetworks(
["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"]
)
..addBillingAddressRequired(true)
..addPhoneNumberRequired(true)
..addShippingAddressRequired(true)
..addShippingSupportedCountries(["US", "GB","BR"])
..addMerchantInfo("Example");
Result result = await FlutterGooglePay.makeCustomPayment(pb.build()).catchError((error) {
print(error);
});
if (result.status == ResultStatus.SUCCESS) {
print('Success');
} else if (result.error != null) {
print(result.error);
}
}
}
Future<Map<String, dynamic>> index() async {
var payer = {
'email': '[email protected]'
};
var preference = {
"items": [
{
"title": "Test",
"quantity": 1,
"currency_id": "BRL",
"unit_price": 10.4,
"payer":payer
}
],
};
var result = await mercadoInstance.mp.createPreference(preference);
return result;
}
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
return Scaffold(
backgroundColor: Color(0xff5c31b8),
appBar: AppBar(
backgroundColor: Color(0xff5c31b8),
elevation: 0,
actions: <Widget>[],
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: widget.mediaWidth * 0.9,
),
child: TextFieldFormulario(
context,
textInputAction: TextInputAction.next,
style: AntipastoTextStyle(
color: Colors.white, fontSize: 20.0),
labelText: "Numero do Cartão ",
labelStyle: AntipastoTextStyle(
color: Colors.white, fontSize: 20.0),
),
),
],
),
FlatButton(
child: Text('Google Pay'),
onPressed: ()async{
_makeCustomPayment();
},
),
FlatButton(
child: Text('Mercado Pago'),
onPressed: ()async{
var payment = await index();
print(payment);
var url = payment['response']["sandbox_init_point"];
String iDe = payment['response']["id"];
var result = await mercadoInstance.mp.getPreference(iDe);
print(result);
},
)
],
),
)
);
}
}
it gives me the error message:
Exception has occurred.
NoSuchMethodError (NoSuchMethodError: The getter 'keys' was called on null.
Receiver: null
Tried calling: keys)
Thanks
Because mercadopago_sdk >=1.3.0 depends on test ^1.16.8 which depends on analyzer ^1.0.0, mercadopago_sdk >=1.3.0 requires analyzer ^1.0.0.
So, because audasiuz depends on both analyzer ^0.40.6 and mercadopago_sdk ^1.3.0, version solving failed.
pub get failed (1; So, because audasiuz depends on both analyzer ^0.40.6 and mercadopago_sdk ^1.3.0, version solving failed.)
Just a question to know if this repository is active or has it been abandoned? thank you
Any chance we could get a basic payment flow as an example? I've read the doc but I think I'm missing a lot of information.
I have created this so far, but then I'm not sure what's next on the list.
Future<void> startMP() async {
MP mercadoPago = MP('6924219732628689', 'yd5kmBOBHhXE24GuOVK9iozt5D8vjyY2');
String token = await mercadoPago.getAccessToken();
var payer = {'email': '[email protected]'};
var preference = {
"items": [
{
"title": "Test01",
"quantity": 1,
"currency_id": "USD",
"unit_price": 0.01,
"payer": payer,
}
],
};
var result = await mercadoPago.createPreference(preference);
}
What's next? Thank you.
You have a exmple to use custom checkout?
I am developing a marketplace in Flutter using this package to access the MercadoPago API to build a Transparent Checkout. However, to add a card, I believe I need the createCardToken
function. But it doesn't exist in the package, right? How should I implement the adding card feature?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.