Simple explanation of how to use the SDK methods.

Initialize SDK

Initialize the SDK using this method.

Check for Cards in the Wallet

First, try using MeaPushProvisioning.GooglePay.checkWalletForCardToken(...) to get the tokenId and tokenState.

If that method doesn't find anything, try MeaPushProvisioning.GooglePay.getRegisteredTokens(...).

Possible outcomes:

  1. You get a tokenId:
    • If tokenState is GooglePayTokenState.TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION, show the Add to Google Pay button (yellow path).
    • If tokenState is NOT GooglePayTokenState.TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION, the card is already in the wallet. Do NOT show the Add to Google Pay button.
  2. You don't receive any tokenId: show the Add to Google Pay button.

Add Card to Wallet

You have 2 methods to add a card to the wallet:

  1. No tokenId → basic flow. Use MeaPushProvisioning.GooglePay.pushCard(...)
  2. Have tokenId, but tokenState is GooglePayTokenState.TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION → yellow flow. Use MeaPushProvisioning.GooglePay.tokenize(...)

Subscribe to Wallet Data Change Events

Use these two methods to manage wallet change events:

  • MeaPushProvisioning.GooglePay.registerDataChangedListener
  • MeaPushProvisioning.GooglePay.removeDataChangedListener

Read more about them here