Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Braintree integration for PayPal payments in Flutter

I have to integrate PayPal payments in Flutter and the only plugin that seems to have this kind of functionality is flutter_braintree. But the documentation there is not so detailed, so I am kind of confused how to use this plugin to have real payments. My mission is to have this kind of flow: click on a PayPal button in the app and then proceed with PayPal paying to a predefined IBAN. I tried to examine the PayPal and Braintree documentations, but since there is nothing mentioned for Flutter, I am a little bit confused. Please help me what's the right direction to go in order to fulfil my requirements. I have the following questions:

  1. How to use this plugin and make real payments? What do I need - a client token as far as I see, but I am going to generate this in Flutter?
  2. Where should I put the IBAN that I want the money to be transferred to?
  3. Am I supposed to use some kind of webviews for the PayPal, or this plugin is enough?

Thank you in advance, I am really stuck on this topic and can't find a solution.

like image 508
scourGINHO Avatar asked Feb 05 '20 14:02

scourGINHO


People also ask

How do I integrate PayPal payment gateway in flutter?

How to Integrate PayPal with Flutter. For flutter payment integration, you need to perform specific actions. First, you need to make a dart file called PaypalPayment. It contains the WebView widget and Paypal URLs where the payment must be completed.

How do you use Braintree in flutter?

You must first create a Braintree account. In your control panel you can create a tokenization key. You likely also want to set up a backend server. Make sure to read the Braintree developer documentation so you understand all key concepts.


1 Answers

Generate clientToken in php | nodejs see: https://developers.braintreepayments.com/reference/request/client-token/generate/php

$clientToken = $gateway->clientToken()->generate([
  "customerId" => '21534539348326'//create customer in panel 
]);`

Generate paymentNonce in app flutter:

BraintreePayment braintreePayment = new BraintreePayment();
    var data = await braintreePayment.showDropIn(
        nonce: clientNonce,
         amount: "2.0", 
        inSandbox: true,
    );
    print("Response of the payment $data");

// exe: Generate transaction in php | nodejs see: https://github.com/braintree/braintree_php

$result = $gateway->transaction()->sale([
  'amount' => '1000.00',
  'paymentMethodNonce' => 'nonceFromTheClient',
  'options' => [ 'submitForSettlement' => true ]
]);
like image 125
Danilo Santos Avatar answered Nov 09 '22 20:11

Danilo Santos