Flutter PayPal Integration

Juned Raza
3 min readOct 14, 2020

As an app developer, we may need payment service in our application. We can add PayPal payment gateway in our flutter application using the Webview plugin all we have to do is install dependencies in our pubspec.yaml file like this :

Adding Dependencies

Now we can move into adding a payment feature in our app we just need two more steps

Photo by Bermix Studio on Unsplash

Now we have to create a home page or Initial page for our app that can call the payment screen for the application or you can call the payment from any widget using the onTap method of Button, GestureDetector, or InkWell. So here is an example of a basic home page.

We need to pass the name of the product and the price of the product for which we need the payment to be done now coming to the main part, creating the function for payment.

Before proceeding ahead we need a Paypal developer account for the necessary clientId and secret key. You can create one here.

After getting all the required things we have to create two new files PaypalPayment.dart and PaypalServices.dart.

In the PaypalService.dart we have to set our clientId, secret key, and the domain like production or the sandbox (we can use the sandbox as a testing mode).



Here we have to fill in all the information about the payment like the name and price. You can also fill in the additional information about the delivery address or you can make a separate function to store the data.

You can change the return URL, cancel URL, and invoice details according to your need either manually or dynamically.

Here is the UI in the app

Paypal Payment Gateway in Flutter App

You can find the source code here

Thanks for reading I hope it helps you. You can ask any question in my email or message me on Linkedin click here.



Juned Raza

Flutter Developer, Andriod Application Developer, Django Developer ,Computer Engineering student at ZHCET, Aligarh Muslim University.