Skip to main content

V2 - Enabling Google Pay

Using the v3 API

Paul Tomes avatar
Written by Paul Tomes
Updated over a year ago

IMPORTANT NOTE: CHERRYPIE IS NO LONGER SUPPORT**

PassKit released the all new PassKit Platform in early 2020. This platform incorporates decades of experience designing, developing and implementing world class mobile wallet solutions for some of the biggest international brands. And at the same time, working with small businesses all over the world to help them access the cool capabilities of Apple Wallet and Google Pay passes. We have combined these rich learnings, proven best practices and ever growing knowledge, to deliver you the very best mobile wallet management platform. A platform where you can extend your mobile reach by quickly integrating Apple Wallet and Google Pay Passes into your business. Into your processes. Into your systems. And most importantly into your customer experience.

PassKit now delivers dedicated modules to solve your specific business use cases. No longer do you need to waste time learning about ‘passes’ language. No longer do you need to study mobile wallet terminology. You now work with Mobile Wallet API’s designed around your business processes; your language. A language you are already familiar with.

--------------------

FOR LEGACY USERS

Before you start you will need the following,

  1. Google Pay service account details (We will provide these for you)

  2. Images for the Google Pay template, You can find an image template here 

  3. Upload the images to your CherryPie account

  4. Access to Postman

  5. Your API Key and Secret 

STEP 1 - Check your campaign is enabled for Google Pay.

We need to use the Retrieve Campaign API call 

GET https://api-pass.passkit.net/v3/campaigns/{campaignName}

You will need to look for the following fields,

  • googleServiceAccount

  • googleIssuerId

If they are not present you need to add them to the campaign using the following,

PUT https://api-pass.passkit.net/v3/campaigns/{campaignName}

{
"googleServiceAccount": "***@***.iam.gserviceaccount.com",
"googleIssuerId": "3453************"
}

When done you can now set up the template.

STEP 2 - Setting up the template.

Firstly retrieve the template using the Retrieve Template API call.

GET https://api-pass.passkit.net/v3/templates/{templateName}

Then change the call to PUT and copy the template record into the top window in Postman.

We can then add the Google Pay section to the template.  The section should look like this.

    "androidPay": {

        "issuerName": "Abba Java ",

        "allowMultipleUsersPerObject": false,

        "hexBackgroundColor": "#FFFFFF",

        "heroImage": {

            "sourceUri": {

                "uri": "https://passkit-portal-production.s3.amazonaws.com/images/d75621ef92dea9d693bc680f893b03a9586781b9.png"

            }

        },

        "barcode": {

            "altText": "pid",

            "altTextOption": "text",

            "format": "pdf417",

            "message": "pid",

            "messageOption": "message"

        },

        "textModulesData": [

            {

                "defaultValue": [

                    {

                        "header": "Name",

                        "body": "${name}"

                    },

                    {

                        "header": "Offer ",

                        "body": "#{offer}"

                    },

                    {

                        "header": "Expires",

                        "body": "01/01/2020"

                    }

                ]

            }

        ],

        "linkModulesData": {

            "uris": [

                {

                    "uri": "www.passkit.com",

                    "description": "Website"

                },

                {

                    "uri": "tel:+85258049280",

                    "description": "Telephone Number "

                }

            ]

        },

        "type": "offer",

        "offerClass": {

            "title": "Discount Offer",

            "redemptionChannel": "both",

            "provider": "Abba Java",

            "titleImage": {

                "sourceUri": {

                    "uri": "https://passkit-portal-production.s3.amazonaws.com/images/2333e625b429ed78397a64adaafa411eb8dc0dc6.png"

                }

            }

        }

    },

  NOTE - the section is referred to as "androidPay", this is due to a name change from Android Pay to Google Pay, "androidPay" remains the standard name when using our API.

Find this section in the Template Json, and insert the Google Pay section.


        "barcode": {
            "altTextOption": "pid",
            "format": "qr",
            "message": "",
            "messageOption": "pid",
            "messageEncoding": "UTF-8"
        },
        "barcodes": [
            {
                "altTextOption": "pid",
                "format": "pdf417",
                "message": "",
                "messageOption": "pid",
                "messageEncoding": "UTF-8"
            }
        ],
       ----- INSERT CODE HERE -----
   
    "issued": 25,
    "pushed": 10,
    "passbookDevices": 12,
    "androidPayDevices": 0,
    "locations": null
}

Then use the PUT command to save the Google Pay section to the template record.

PUT https://api-pass.passkit.net/v3/templates/{templateName}

After, use the push parameter at the end of the above URL, this is important  as the PUSH command ensures that we do the API call to Google to actually create the Google Pay Class

PUT https://api-pass.passkit.net/v3/templates/{templateName}/push

When complete, the full template JSON will look like this

{

    "index": "TZn8YK2z",

    "name": "Abba_Java_Demo",

    "campaignName": "Abba_Java_Demo",

    "status": "ACTIVE",

    "language": "en",

    "startDate": "2016-06-15T00:00:00Z",

    "endDate": "2020-12-31T00:00:00Z",

    "createdAt": "2019-07-25T06:28:55.215826647Z",

    "updatedAt": "2019-07-30T02:37:34.981105833Z",

    "pushedAt": "2019-07-30T02:37:56.181458562Z",

    "eventHooks": null,

    "timezone": 7,

    "maxIssue": 0,

    "dynamicKeys": [

        {

            "key": "name",

            "type": "string",

            "defaultValue": "",

            "isEditable": true

        },

        {

            "key": "offer",

            "type": "string",

            "defaultValue": "",

            "isEditable": false

        }

    ],

    "dynamicImageKeys": {

        "passbook": {

            "background": {

                "isDynamic": true,

                "isEditable": false

            },

            "footer": {

                "isDynamic": false,

                "isEditable": false

            },

            "icon": {

                "isDynamic": true,

                "isEditable": false

            },

            "logo": {

                "isDynamic": true,

                "isEditable": false

            },

            "strip": {

                "isDynamic": false,

                "isEditable": false

            },

            "thumbnail": {

                "isDynamic": true,

                "isEditable": false

            }

        },

        "androidPay": {

            "strip": {

                "isDynamic": false,

                "isEditable": false

            }

        }

    },

    "passbook": {

        "type": "storeCard",

        "eventStyle": "background",

        "orgName": "Abba Java",

        "desc": "Test",

        "bgColor": {

            "blue": 0,

            "green": 0,

            "red": 0

        },

        "labelColor": {

            "blue": 41,

            "green": 172,

            "red": 33

        },

        "fgColor": {

            "blue": 255,

            "green": 255,

            "red": 255

        },

        "iconFile": "images/5Q80Y4sr5Puy/Abba_Java_Demo/passbook-IconFile-4d93540e2fc8cda959181c16470d890737f3dde3.png",

        "logoFile": "images/5Q80Y4sr5Puy/Abba_Java_Demo/passbook-LogoFile-653156a1a727e7fdec8e5f121c5d629aa34715d8.png",

        "stripFile": "images/5Q80Y4sr5Puy/Abba_Java_Demo/passbook-StripFile-a8759b2006366a35e98e4b55369eff62cc893f0a.png",

        "header": [

            {

                "defaultLabel": "Expires",

                "defaultValue": "01/01/2020",

                "textAlign": "natural",

                "format": {

                    "type": "text",

                    "dateFormat": "medium",

                    "numberFormat": "decimal"

                }

            }

        ],

        "back": [

            {

                "defaultValue": [

                    {

                        "itemName": "news",

                        "changeMsg": "Get 2 free drink for being cool %@",

                        "defaultLabel": "Updates",

                        "defaultValue": "Updated News or offers",

                        "format": {

                            "type": "text"

                        }

                    },

                    {

                        "defaultLabel": "Terms and Conditions",

                        "defaultValue": "See Website for more details - www.abba-java.com",

                        "format": {

                            "type": "text",

                            "dateFormat": "medium",

                            "numberFormat": "decimal"

                        }

                    }

                ]

            }

        ],

        "secondary": [

            {

                "defaultLabel": "Name",

                "defaultValue": "${name}",

                "textAlign": "",

                "format": {

                    "type": "text"

                }

            },

            {

                "itemName": "remain",

                "defaultLabel": "Offer",

                "defaultValue": "#{offer}",

                "textAlign": "right",

                "format": {

                    "type": "text",

                    "dateFormat": "medium",

                    "numberFormat": "decimal"

                }

            }

        ],

        "barcode": {

            "altTextOption": "pid",

            "format": "qr",

            "message": "",

            "messageOption": "pid",

            "messageEncoding": "UTF-8"

        },

        "barcodes": [

            {

                "altTextOption": "pid",

                "format": "pdf417",

                "message": "",

                "messageOption": "pid",

                "messageEncoding": "UTF-8"

            }

        ]

    },

    "androidPay": {

        "issuerName": "Abba Java ",

        "allowMultipleUsersPerObject": false,

        "hexBackgroundColor": "#FFFFFF",

        "heroImage": {

            "sourceUri": {

                "uri": "https://passkit-portal-production.s3.amazonaws.com/images/d75621ef92dea9d693bc680f893b03a9586781b9.png"

            }

        },

        "barcode": {

            "altText": "pid",

            "altTextOption": "text",

            "format": "pdf417",

            "message": "pid",

            "messageOption": "message"

        },

        "textModulesData": [

            {

                "defaultValue": [

                    {

                        "header": "Name",

                        "body": "${name}"

                    },

                    {

                        "header": "Offer ",

                        "body": "#{offer}"

                    },

                    {

                        "header": "Expires",

                        "body": "01/01/2020"

                    }

                ]

            }

        ],

        "linkModulesData": {

            "uris": [

                {

                    "uri": "www.passkit.com",

                    "description": "Website"

                },

                {

                    "uri": "tel:+85258049280",

                    "description": "Telephone Number "

                }

            ]

        },

        "type": "offer",

        "offerClass": {

            "title": "Discount Offer",

            "redemptionChannel": "both",

            "provider": "Abba Java",

            "titleImage": {

                "sourceUri": {

                    "uri": "https://passkit-portal-production.s3.amazonaws.com/images/2333e625b429ed78397a64adaafa411eb8dc0dc6.png"

                }

            }

        }

    },

    "issued": 1,

    "pushed": 1,

    "passbookDevices": 0,

    "androidPayDevices": 0,

    "locations": null

}

Common Reasons For Errors

  1. Images do not conform to the correct size specification

  2. The 'push' command was not carried out after the template update

  3. The Campaign was not enabled first

  4. If using dynamic values, you must issue a pass with these values in place, else the Google Pay template will not load.

** CherryPie is longer maintained; other critical security updates.

Did this answer your question?