Skip to content

dimquea/cordova-plugin-gpay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-gpay

Cordova plugin for Master Card - Google Pay integration Modified for use in Russia with SberBank + translated errors.

Notes

This plugin only supports Android.

This plugin will add these dependencies to your build.gradle file:

com.google.android.gms:play-services-wallet:15.0.0
com.android.support:support-v13:27.+
com.android.support:appcompat-v7:27.1.0

Installation

cordova plugin add https://github.com/dimquea/cordova-plugin-gpay

Quick Example

Run below on onDeviceReady function

  GooglePay.isReadyToPay().then(function() {
    GooglePay.requestPayment('merchantID', 1000, 'RU').then(function(token) {
      alert(token);
    }).catch(function(err) {
      alert(err);
    });
  }).catch(function(err) {
    alert(err);
  });

Default gateway identefier is 'sberbank'. You may change it in src\android\GooglePay.java:190

Usage

This plugin puts the functions into window.GooglePay . All functions return a promise.

GooglePay.isReadyToPay()
  • Used to test if the appropriate payment method is available on the current device.
  • Resolves if appropriate payment method is available
  • Rejects if not, or if it encounters an error
GooglePay.requestPayment(identifier, totalPrice, currency)
  • Initiates the payment journey for the user to complete.
  • identifier your merchant ID
  • totalPrice must be a string representation of the total price - e.g. for £10.78, it would be 10.78
  • currency must be a valid ISO 4217 currency code for the transaction
  • Resolves when the journey is complete, with the payment gateway token
  • Rejects if an error occurs

Switch to PRODUCTION

You need to request for production access before test on production environment. Carefully go through the CHECK LIST mentioned in this LINK and REQUEST PRODUCTION ACCESS

Why this error after switching to PRODUCTION?

Request Failed

Make sure you check the APK on a real device and not on an emulator.

Credits

Originally posted by Srini-max.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 97.0%
  • JavaScript 3.0%