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.
It utilizes Flutter Webview, to complete the payment process... "It's a Simple Spell But Quite Unbreakable".
Razor Pay is one of the best payment gateways which provided plugin in a flutter.
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.
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.
Open Braintree Sandbox Account
Get the tokenization key from Braintree account
Add the flutter_braintree dependencies in your pubspec.yaml file
dependencies:
flutter_braintree: ^0.5.3+1
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,
);
Get the NONCE from Braintree after successful payment and get the failure message on cancel the Paypal Payment by the user.
Save this NONCE for future reference in your database
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With