Please, ensure that you use approved branding (e.g. buttons and assets) as provided by either Google Pay Android brand guidelines or Google Pay Web brand guidelines when
Fondy supports the following values of parameters for every settlement region:
const allowedCardNetworks = ["MASTERCARD", "VISA"]; const allowedCardAuthMethods = ["PAN_ONLY", "CRYPTOGRAM_3DS"];
Pay attention, that BillingAddressParameters parameter is optional.
If you do not use SDK please define values for gatewayMerchantId and gatewayID parameters explicitly:
gatewayMerchantId: <your Fondy merchant_id> gatewayID: fondyeu
If you prefer to integrate directly against the Google Pay API, follow Google’s instructions.
{ "apiVersion": 2, "apiVersionMinor": 0, "allowedPaymentMethods": [ { "type": "CARD", "parameters": { "allowedAuthMethods": [ "PAN_ONLY", "CRYPTOGRAM_3DS" ], "allowedCardNetworks": [ "VISA", "MASTERCARD" ] }, "tokenizationSpecification": { "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "fondyeu", "gatewayMerchantId": "" } } } ], "transactionInfo": { "totalPrice": "", "totalPriceStatus": "FINAL", "currencyCode": "" } }
Please follow our base payment integration instruction to obtain checkout_url.
Follow our instructions on JavaScript integration.
Add elements #mobilepay and #checkout to your site body
<div id="mobilepay"></div> <div id="checkout"></div>
Load Google Pay button on your page:
<script>
$ipsp('checkout').config({
'wrapper': '#checkout',
'styles': {},
'mobilepay': {
'container': '#mobilepay',
'style': 'white-outline'
}
}).scope(function () {
this.width(480);
this.height(480);
this.addCallback('DEFAULTCALLBACK');
this.action('canMakePayment', function (data) {
log(data);
});
this.action('log', function (data) {
log(data);
});
this.loadUrl(checkout_url);
});
</script>
No development from merchant side required to enable Google Pay button on Fondy hosted checkout page or in Javascript SDK.
Google Pay button is enabled for all Fondy merchants in supported regions automatically.
Currently supported regions:
If you do not see Google Pay button enable in your web integration, please contact Fondy support team by email: support@fondy.eu or your personal Account Manager. Possibly your integration must be reviewed and corrected, to enable Google Pay. For example, if you have a custom checkout design, you will require to update it.
Use the Fondy Java Android SDK to start accepting Google Pay in your Android apps.
To connect Google Pay to the Android mobile app, follow these steps:
Add dependencies to your project in app/build.gradle. This implementation requires Google Play services 17.0.0 or greater as well as Fondy Android SDK.
implementation 'com.google.android.gms:play-services-base:17.0.0' implementation 'com.google.android.gms:play-services-wallet:17.0.0' implementation 'com.cloudipsp.android:+'
Update AndroidManifest.xml to enable Google Pay API.
Add the following lines:
<application ...> .... <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" /> .... </application>
For more information please follow Google Pay API setup instruction
Create an instance of Cloudipsp with your MerchantID identifier from Fondy Merchant Portal:
cloudipsp = new Cloudipsp(<your merchant_id>, webView);
Add OnClick listener function on the Google Pay button.
Check this code for example:
In OnClick method call static method – Cloudipsp.supportsGooglePay();
Please check our demo example
Initiate payment on backend and obtain payment token:
Create order at your server:
curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{ "request": { "server_callback_url": "http://myshop/callback/", "order_id": "TestOrder_JSSDK_v2", "currency": "USD", "merchant_id": 1396424, "order_desc": "Test payment", "lifetime" : 999999, "amount": 1000, "signature": "91ea7da493a8367410fe3d7f877fb5e0ed666490" } }' \ 'https://pay.fondy.eu/api/checkout/token'
Receive payment token:
{ "response":{ "response_status":"success", "token":"b3c178ad84446ef36eaab365b1e12e6987e9b3d9"} }
Call method – googlePayInitialize with token
In onGooglePayInitialized method by accepting the GooglePayCall class object into the component.
You should save it in onSaveInstanceState and restore it in onCreate methods. This is necessary due to the fact that the during external component load, the SDK component can be unloaded from memory.
Pass the result from onActivityResult to the SDK.
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RC_GOOGLE_PAY: if (!cloudipsp.googlePayComplete(resultCode, data, googlePayCall, this)) { Toast.makeText(this, R.string.e_google_pay_canceled, Toast.LENGTH_LONG).show(); } break; } }
Handle result in the onPaidProcessed and onPaidFailure methods of the Cloudipsp.PayCallback interface.
Use the Fondy React-Native Android SDK to start accepting Google Pay in your Android apps.
by command:
react-native link react-native-cloudipsp
or manually add lines
to android/settings.gradle:
include ':react-native-cloudipsp' project(':react-native-cloudipsp').projectDir = new File( rootProject.projectDir, '../node_modules/react-native-cloudipsp/android' )
where react-native-cloudipsp – SDK, developed by Fondy team.
to android/app/build.gradle in dependencies
implementation project(':react-native-cloudipsp') implementation 'com.google.android.gms:play-services-base:16.0.1' implementation 'com.google.android.gms:play-services-wallet:16.0.1'
Add ReactPackage to your Application class:
new RNCloudipspPackage() protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new RNCloudipspPackage(), .... ); }
put your MerchantID from Fondy Merchant Portal in Cloudipsp class initialization:
this.cloudipsp = new Cloudipsp(<your merchant_id>, (payConfirmator) => { this.setState({ webView: 1 }); return payConfirmator(this.cloudipspWebView); });
Add onPress event function on the Google Pay button.
Check this code for example:
https://github.com/cloudipsp/react-native-cloudipsp/blob/master/Example/index.tsx
In onPress method call static method – Cloudipsp.supportsGooglePay();
Please check our demo example
Use googlePay or googlePayToken method to process Google Pay payment.
const order = new Order(...); ... cloudipsp.googlePay(order) .then((receipt) => { //handle payment result }) .catch((error) => { //handle payment error });
Handle result in the Promise.
gatewayMerchantId: <your Fondy merchant_id> gatewayID: fondyeu