Cordova plugin for Master Card - Google Pay integration Modified for use in Russia with SberBank + translated errors.
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
cordova plugin add https://github.com/dimquea/cordova-plugin-gpay
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
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.
identifieryour merchant IDtotalPricemust be a string representation of the total price - e.g. for £10.78, it would be 10.78currencymust 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
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
Make sure you check the APK on a real device and not on an emulator.
Originally posted by Srini-max.
MIT