How to retrieve the secrets for MeaWallet SDKs

How to retrieve the secrets for MeaWallet SDKs

StepDescription
1"Get the secrets from the platform

HaaS API
<https://haas.dev.hay.co/swagger-ui.html#/card-controller/getOemProvisioningDataUsingGET>

Hay GraphQL API
getOemProvisioningDataForWalletChecks(cardId: ID!): OemProvisioningData
2"Create the cardId and cardSecret fields

Ref MeaWallet - iOS Card data parameters (https://developer.meawallet.com/docs/developer-docs/mea-push-provisioning/ios/#card-data-parameters) | Android Card data parameters (https://developer.meawallet.com/docs/developer-docs/mea-push-provisioning/android/#card-data-parameters)

The cardId used by the Mea SDKs is different to the standard Hay Card ID. It is formed by joining the cardToken expiryDate and Base64(Utf8.parse(cardHolderName)) fields, separated by hashes.

The cardSecret is created by prefixing the otp with 001#.

An example of how to do this in JavaScript can be seen below.

const createOemTokens = (oemProvisioningData: OemProvisioningData) => {
const { cardToken, expiryDate, cardHolderName, otp } = oemProvisioningData;
const base64HolderName = Base64.stringify(Utf8.parse(cardHolderName));

return {
cardId: ${cardToken}#${expiryDate}#${base64HolderName},
cardSecret: 001#${otp},
};
};"
3"Prepare additional data for SDKs

iOS
Ref MeaWallet - Initialise Apple Pay In-App provisioning (https://developer.meawallet.com/docs/developer-docs/mea-push-provisioning/ios/#initialize-apple-pay-in-app-provisioning)

As per the MeaWallet iOS documentation it is recommended to retrieve and cache the primaryAccountIdentifier field. You can obtain this field by initiating the in-app push provisioning as per the docs found here (https://developer.meawallet.com/docs/developer-docs/mea-push-provisioning/ios/#initialize-apple-pay-in-app-provisioning), or you can use one of our APIs:

HaaS API
<https://haas.dev.hay.co/swagger-ui.html#/card-controller/getDigitalWalletDetailsUsingGET>

Hay GraphQL API
You need to query for the digitalWalletDetails field from the CardMeta type which will return the primaryAccountIdentifier as well as the list of successfully provisioned tokens.

getCardsMeta(accountId: ID): [CardMeta]

Android
Ref MeaWallet - Initialize and push provision card (https://developer.meawallet.com/docs/developer-docs/mea-push-provisioning/android/#initialize-and-push-provision-card)

As well as the cardId and cardSecret parameters you also need to provide the MeaPushProvisioning.GooglePay.pushCard method the address of the user. You can easily retrieve this information from our APIs

HaaS API
<https://haas.dev.hay.co/swagger-ui.html#/customer-controller/getHayCustomerByIdUsingGET>

Hay GraphQL API
getPersonalDetails: User"