API FONDYVersion 1.0

Google Pay requirements

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

  • creating a payment button on your site
  • creating a payment button in your application layout
  • referencing Google Pay on your site, in a mobile application, when communicating with the clients

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

Google Pay activation instructions for direct integration

If you prefer to integrate directly against the Google Pay API, follow Google’s instructions.

  1. Obtain the payer encrypted payment data returned by Google Pay using the following configuration:
    {
      "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": ""
      }
    }
    
  2. Submit the encrypted payment data to your server.
  3. Resend encrypted payment data from your server to FONDY payment API endpoint https://pay.fondy.eu/api/3dsecure_step1/ in parameter container (see specifications)
  4. Obtain payment final response from FONDY server with order details
  5. Inform payer about payment result

Google Pay activation instructions for merchant hosted integration on web with JavaScript SDK

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>

 

Google Pay activation instructions for FONDY hosted checkout page (Web)

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:

  • Ukraine
  • Europe

If you do not see Google Pay button enable in your web integration, please contact FONDY your 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.

Google Pay activation instructions for mobile application (Java)

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:

Step 1: Setup your application

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

Step 2: Setup your MerchantID

Create an instance of Cloudipsp with your MerchantID identifier from FONDY Merchant Portal:

cloudipsp = new Cloudipsp(<your merchant_id>, webView);

Step 3: Create Google Pay button in your application layout

Add OnClick listener function on the Google Pay button.

Check this code for example:

https://github.com/cloudipsp/android-sdk/blob/master/app/src/main/java/com/cloudipsp/android/demo/BaseExampleActivity.java

Step 4: Make sure that Google Pay is supported on the device and user account.

In OnClick method call static method – Cloudipsp.supportsGooglePay();

Please check our demo example

Step 5: Initiate the payment process.

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

Step 6: Process the payment

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.

Step 7: Complete payment.

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;
    }
}

Step 8: Handle payment results

Handle result in the onPaidProcessed and onPaidFailure methods of the Cloudipsp.PayCallback interface.

 

Google Pay activation instructions for mobile application (React-Native)

Use the FONDY React-Native Android SDK to start accepting Google Pay in your Android apps.

Step 1: Link FONDY SDK module.

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(),
                          ....
    );
}

Step 2: Setup your MerchantID

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);
});

Step 3: Create a Google Pay button in your application layout

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

Step 4: Make sure that Google Pay is supported on the device and user account.

In onPress method call static method – Cloudipsp.supportsGooglePay();

Please check our demo example

Step 5: Process the payment

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.

 

Google Pay mobile application approval

  1. Before integrating FONDY mobile SDK, register merchant in FONDY Merchant Portal and request FONDY support to enable Google Pay on your account. You will get a merchant ID in test mode.
  2. Build your app using FONDY merchant ID in test mode with FONDY SDK. FONDY SDK will use ENVIRONMENT_TEST mode and
    gatewayMerchantId: <your FONDY merchant_id>
    gatewayID: fondyeu
  3. Follow instructions to request Google for production access: https://developers.google.com/pay/api/web/guides/test-and-deploy/request-prod-access
  4. Google will review the application according to its integration checklist and provide recommendations if necessary.
  5. If all requirements are met, production access is granted.
  6. Request FONDY support to switch your merchant ID to LIVE with ENVIRONMENT_PRODUCTION mode.
  7. Submit production APK pointing to LIVE merchant ID to Google for approval.

 

Connect to FONDY and learn more!