Integrating Paypal Payment Gateway In Flutter

Posted By : Lucky Mehndiratta | 24-Mar-2020

This blog post highlights the process of integrating PayPal payment gateway in Flutter. In this digital era, online bill payments are gaining traction as people want to cashless. To facilitate secure digital transactions, we need to integrate payment gateways into various mobile applications. It enables users to pay their bill or purchase new items right from the mobile app. There are lots of payment gateways in the market to achieve this task and do it in a safe and secure manner but Paypal Payment Gateway is the best option to accept and pay bills, both domestic and international. In this tutorial, we will learn how to achieve PayPal integration in-line with Flutter app development services.

 

What Is Braintree?

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

 

Steps to Integrate Paypal in Flutter

 

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,

);

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

6. Save this NONCE for future reference in your database 

 

 

Conclusion

Now, you know how to integrate Paypal Payment gateway in Mobile Application using Braintree.  For more information and check whether Paypal will allow you to integrate Paypal Payment gateway in your country or not please refer to Paypal official documents.

 

About Author

Author Image
Lucky Mehndiratta

He worked on swift language, UI Design, Api. He is quick in his work and performs at his best.

Request for Proposal

Name is required

Comment is required

Sending message..