Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Paypal payments in Flutter app

I just started on my Flutter journey and need to integrate Paypal payments into my app. However, there seems to be no standard Flutter API provided by Paypal and I couldn't find an acceptable answer anywhere.

like image 568
Kalyan Avatar asked Jan 01 '20 00:01

Kalyan


People also ask

Does PayPal use flutter?

It utilizes Flutter Webview, to complete the payment process... "It's a Simple Spell But Quite Unbreakable".

Which payment gateway is best for flutter?

Razor Pay is one of the best payment gateways which provided plugin in a flutter.


2 Answers

You can achieve this using WebView. PayPal provides some APIs to do transaction. Using those APIs you can achieve this.

Read this article

Paypal Payment Gateway Integration in Flutter

This article demonstrates the steps you need to follow.

like image 88
Gulshan Yadav Avatar answered Oct 12 '22 06:10

Gulshan Yadav


Braintree is the payment processor provided by Paypal to accept safe and secure payments with feature Drop-in UI and custom UI design. It also provides the Apple Pay, Google Pay feature to accept the payments.

  1. Open Braintree Sandbox Account

  2. Get the tokenization key from Braintree account

  3. Add the flutter_braintree dependencies in your pubspec.yaml file

    dependencies:
    flutter_braintree: ^0.5.3+1

  4. Create custom UI

Paypal Credit card: accept the followings from user

a. Card Number

b. Expiration Month

c. Expiration Year

Create a Braintree Request

final request = BraintreeCreditCardRequest(

  card number: '4115511771161116',

  expiration month: '02',

  expiration year: '2020',

);

Ask Braintree to tokenization it

BraintreePaymentMethodNonce result = await Braintree.tokenizeCreditCard(

   '<Insert your tokenization key>',

   request,

);

For PayPal

create Paypal request

final request = BraintreePayPalRequest(amount: '50.00');

then launch Paypal Request

BraintreePaymentMethodNonce result = await Braintree.requestPaypalNonce(

   "Insert your tokenization key or client token here",

   request,

);
  1. Get the NONCE from Braintree after successful payment and get the failure message on cancel the Paypal Payment by the user.

  2. Save this NONCE for future reference in your database

like image 22
persec10000 Avatar answered Oct 12 '22 04:10

persec10000