API hutko

 

 

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

hutko supports the following values of parameters:

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 hutko merchant_id>
gatewayID: hutko

Google Pay and 3DSecure

3DSecure authentication will be required for Google Pay for authorization method PAN_ONLY .

Consider this when implementing accept purchase with direct method as it can require two-steps flow:

  • create order: POST /api/3dsecure_step1

  • submit 3DSecure data: POST /api/3dsecure_step2

 

Google Pay for direct integration

If you prefer to integrate directly against the Google Pay API, follow the Google Pay™ API documentation:

For Android: Google Pay Android developer documentationGoogle Pay Android integration checklist and Google Pay Android brand guidelines.

For web: Google Pay Web developer documentationGoogle Pay Web integration checklist and Google Pay Web Brand Guidelines.

Perform the following steps: 

  1. Obtain the Payment Data encrypted payment data returned by Google Pay API 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": "hutko",
              "gatewayMerchantId": ""
            }
          }
        }
      ],
      "transactionInfo": {
        "totalPrice": "",
        "totalPriceStatus": "FINAL",
        "currencyCode": ""
      }
    }
    
  2. Submit the encrypted payment data to your server.
  3. Send encrypted Payment Data from your server to hutko payment API endpoint https://pay.hutko.org/api/3dsecure_step1/ in parameter container (see specifications). Data must be encoded with Base64.
  4. Obtain payment final response from hutko server with order details
  5. Inform payer about payment result

Google Pay for merchant hosted integration on web with JavaScript SDK

Please follow our base payment integration instruction for web-embedded Google Pay button.

Google Pay for hutko hosted checkout page (Web)

No development from merchant side required to enable Google Pay button on hutko hosted checkout page.

Google Pay button is enabled for all hutko merchants in supported regions automatically. 

Currently supported regions:

  • Ukraine

If you do not see Google Pay button enable in your web integration, please contact hutko 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 for mobile application (Java)

Use the hutko 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 hutko 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 hutko 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/hutkorg/android-sdk/blob/main/app/src/main/java/org/hutko/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.hutko.org/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 mobile application approval

  1. Before integrating hutko mobile SDK, register merchant in hutko Merchant Portal and request hutko support to enable Google Pay on your account. You will get a merchant ID in test mode.
  2. Build your app using hutko merchant ID in test mode with hutko SDK. hutko SDK will use ENVIRONMENT_TEST mode and
    gatewayMerchantId: <your hutko merchant_id>
    gatewayID: hutko
  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 hutko 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.

 

Хочу приймати платежі з Hutko!