Naimish Patel
Naimish Patel

Reputation: 67

In Flutter Application Open google pay in device application and return the payment status

In My Application i want to show a one Google pay Button when the user click on this button i want to pass the whom to pay upi id redirect on google pay application transction page and after the payment sucessfully then redirect on my application and show the payment status whatever it sucess or fail,cancle etc.

For the Open the google pay i use Url luncher code But it does not work it not Open direct Google pay

so Give any other solutions for payment integration in google pay,phonepe,paytm in flutter ..

Upvotes: 0

Views: 851

Answers (2)

Himanshu Bora
Himanshu Bora

Reputation: 126

if you have only one purpose to integrate payment then you can use Razorpay Payment. razorpay_flutter . It includes everything from payment apps to card to UPI payments. If you need any other help regarding razorpay do let me know.

Upvotes: 2

Osama Ali
Osama Ali

Reputation: 131

pay package can help you First create dart file (payment_config.dart) inside lib folder that will hold the payment configuration details enter image description here

You can get those payment configuration here: https://github.com/google-pay/flutter-plugin/blob/main/pay/example/lib/payment_configurations.dart let’s define the Google Pay button widget

var googlePayButton = GooglePayButton(
  paymentConfiguration: PaymentConfiguration.fromJsonString(
      defaultGooglePayConfigString),
  paymentItems: [PaymentItem(
    label: 'Total',
    amount: '0.01',
    status: PaymentItemStatus.final_price,
  )],
  type: GooglePayButtonType.pay,
  margin: const EdgeInsets.only(top: 15.0),
  onPaymentResult: onGooglePayResult,
  loadingIndicator: const Center(
    child: CircularProgressIndicator(),
  ),
),

Now you can use this widget anywhere you want and it will make the payment.

Finally you need a google pay business account in google pay console to make real payments.

Upvotes: 0

Related Questions