Maya Mini App

Overview

With the Maya Mini App, the customer's session is shared with your Mini App to enable seamless navigation from the Maya App to your Mini App.

API Sequence


This flow covers both the normal token generation and session usage and the handling of an expired session.

  1. The customer clicks the tile within the Maya App triggering the Maya Mini App.
  2. The Maya Mini App performs an age and KYC (Know Your Customer) check.
  3. If no consent is recorded:
    • Maya App will prompt the customer with the consent screen.
    • The customer will then agree to the terms presented and give consent.
    • Maya Mini App records the consent.
  4. Maya Mini App generates a Customer Access Token (accessToken).
  5. Maya Mini App sends the Customer Access Token (accessToken) to the API Consumer through their session URL endpoint.
  6. The API Consumer saves the Customer Access Token (accessToken) and generates a unique sessionId to correspond with the Customer Access Token (accessToken).
  7. API Consumer sends the sessionId as a response to the Maya Mini App.
  8. The Maya Mini App appends the sessionId to the API Consumer's registered landing page URL.
  9. Maya Mini App redirects the Customer to the API Consumer's landing page URL.
  10. The API Consumer uses the sessionId to verify the saved Customer Access Token (accessToken).
  11. The API Consumer invalidates the sessionId.
  12. The API Consumer prepares the required tokens and credentials acquired from the Maya Mini App:
    • Customer Access Token: the accessToken obtained from Maya through either your session URL or acquired by refreshing the tokens, whichever is the most recent or valid value
    • Client Credentials Token: the access_token acquired during OAuth 2.0 Authentication using the client_credentials grant type
  13. The API Consumer calls the Get Profile endpoint of the Maya Mini App, providing the accessToken and access_token.
  14. Maya Mini App processes the request and retrieves the profile data based on the client scope. Refer to the Supported Scopes section for the list of scopes.
  15. After retrieving the profile data, the Maya Mini App sends the encrypted profile data to the API Consumer.
  16. The API Consumer monitors the Customer Access Token (accessToken) and Customer Refresh Token (refreshToken) expiry.
  17. When the Customer Refresh Token (refreshToken) is about to expire:
    • The API Consumer uses the refreshToken and call the Refresh Token endpoint of the Maya Mini App.
    • Maya Mini App will generate a new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken).
    • Maya Mini App returns the new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken) to the API Consumer.
    • The API Consumer updates their system to save the new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken).
  18. When you need the accessToken but it is already expired:
    • The API Consumer uses the valid or the most recent refreshToken and call the Refresh Token endpoint of the Maya Mini App.
    • Maya Mini App will generate a new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken).
    • Maya Mini App returns the new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken) to the API Consumer.
    • The API Consumer updates their system to save the new Customer Access Token (accessToken) and new Customer Refresh Token (refreshToken).

Build your Integration

For the complete Sandbox Onboarding requirements, contact your designated Maya Relationship Manager.

Whitelist Maya IP Addresses

Implement IP whitelisting and whitelist Maya's IP Addresses in your Mini App.


To enhance security, you should implement IP whitelisting in your Mini App allowing access to Maya systems only. Implement an IP whitelisting mechanism and specify Maya’s IP Addresses.

Note that the Maya Mini App requests should come from the IPs listed below.

EnvironmentIP addresses
Sandbox52.76.175.228
13.251.40.239
13.251.3.237
18.138.3.140
Production18.140.207.36
52.220.51.15
52.74.249.253
52.74.249.189
54.255.23.10
52.220.109.32

Create your Session Initiation Endpoint

Create your dedicated endpoint to accept session details from the Maya Mini App.


You must create a dedicated endpoint, or the Session URL, where Maya can send the customer session securely and efficiently. Each time a customer accesses your application from the Maya app, Maya will send an API request to your Session URL endpoint.

With the customer's consent, Maya Mini App will send the following to your Session URL endpoint:

  • Customer Access Token: the accessToken that your mini app will need to perform actions on behalf of the customer
  • Customer Refresh Token: the refreshToken that your mini app can use to generate a new customer access token

Sample payload your Session URL will receive:

curl --location 'https://your.site.com/mayaminiapp/accept' \
--header 'Request-Reference-No: bbd94290-1078-47c4-bc1a-a5a326afaaf5' \
--header 'Content-Type: application/json' \
--data '{
    "accessToken": "eyJ1aWQiOiI0MGE2YmI1NS1iYzBjLTQzMjktYTE0Yi0wMzlmY2I3ZmRkZjciLCJjbGllbnRfaWQiOiIwZjFmMjJhYy1lMjQzLT",
    "refreshToken": "eyJ1aWQiOiI0MGE2YmI1NS1iYzBjLTQzMjktYTE0Yi0wMzlmY2I3ZmRkZjciLCJjbGllbnRfaWQiOiIwZjFmMjJhYy1lMjQzLT",
    "expiresAt": 1659375851
}'

The Session URL endpoint must be capable of receiving and processing this request according to the provided API contract and shall respond with a sessionId to Maya. Be sure to follow the Session URL API Contract .

Sample Payload your Session URL is expected to respond:

{
    "sessionId": "Lr7I2MPDy_WUnnyCWyEE3737_PZF2VIKlQXbi-Q8kZw"
}

Once you have successfully set up your Session URL, kindly provide the URL endpoint to Maya. Reach out to your Maya Relationship Manager for detailed requirements and guidance throughout the onboarding procedure.

Create the Landing Page

Create your HTML 5 Mobile Web Application Landing Page.


Create a web application your customer can access within the Maya app. It should be mobile-responsive.

Maya will redirect the customer to your landing page, with the sessionId generated by your SessionURL endpoint. Implement the necessary logic and make sure that your landing page accepts and handles sessionId.


Development Considerations for the Landing Page

Maya will redirect the customer to your landing page, with the appended sessionId.

Landing Page URL (Sample): https://your-landing-page-url.com

Landing Page URL with appended sessionId: https://your-landing-page-url.com?sessionId={sessionId-value}

  • Your landing page should be a GET endpoint capable of receiving the sessionId query parameter
  • Invalidate the sessionId after its initial use to prevent reuse; your system should reject any subsequent attempts with the same sessionId
  • Ensure the landing page URL is SSL-secured (https) and publicly accessible.
  • Configure SSL on the standard port 443 to avoid potential network issues with Maya integration

Upon completing the setup of your Landing Page, kindly submit the URL of your Landing Page to Maya. For detailed requirements and guidance through the onboarding process, contact your Maya Relationship Manager.


Manage Mini App Session: New Customer Session

Complete the session initiation for the new customer session.


Your Mini App should be able to identify the customer via the sessionId. One way to do this is to have a mapping of Customer Access Token (accessToken) and sessionId.

Every sessionId your Mini App sends to Maya must be unique and can only be used once. Maya recommends invalidating the session ID once it has been utilized and ensuring that it will not be reused in the future.

In case of subsequent attempts, where the landing page employs the same sessionId, your system should decline or reject the access.


During session initiation, Maya will use the following endpoints you have developed and submitted during onboarding:

Your URL/EndpointsData you'll ReceiveData you'll Return
Session URLaccessToken
refreshToken
expiresAt
sessionId
Landing PagesessionId

Be guided by the flow described in the API Sequence.


Monitoring Tokens: Your Mini App shall monitor the expiry of the customer tokens (accessToken and refreshToken), and keep these tokens valid or updated when the customer is active in your Mini App.


Maya recommends knowing your customer by leveraging the Profile Sharing feature of the Maya Mini App. To verify and enable this feature, contact your designated Maya Relationship Manager.


Manage Mini App Session: Expired Customer Session

Use the refreshToken to refresh the customer session in the Maya Mini App.


At this point, your Mini App should have obtained and secured the following tokens:

  • Customer Refresh Token: the refreshToken obtained from Maya through either your Session URL or acquired by refreshing the tokens, whichever is the most recent or valid value
  • Client Credentials Token: the access_token acquired from Maya during OAuth 2.0 Authentication using the client_credentials grant type

Your Mini App is expected to call Refresh Token endpoint providing the required tokens when:

  • The customer initiates a transaction but the Customer Access Token (accessToken) is already expired
  • The customer is still active in your Mini App and the Customer Refresh Token (refreshToken) is about to expire

Refer also to the Handling of Expired Maya Mini App Tokens for the scenarios and proper handling.


It's important to note that every successful token refresh will invalidate the old tokens, so you should also update your records with the new tokens.



Monitoring Tokens: Your Mini App shall monitor the expiry of the customer tokens (accessToken and refreshToken), and keep these tokens valid or updated when the customer is active in your Mini App.



What's Next?

Once you have implemented the session initiation and the proper handling of tokens, you may now explore and implement the following Maya Mini App features:

You can leverage these features depending on your scope and configuration in Maya. To verify and enable any of these features, contact your designated Maya Relationship Manager.


Endpoints

Partner-hosted Endpoints

These are the endpoints you need to prepare and submit to Maya during onboarding.

NameHTTP MethodDescription
Session URLPOSTYour Session URL; should be capable of receiving the accessToken, refreshToken, expiryAt from Maya and returning a sessionId during session initiation
Landing PageGETYour Landing Page; should be capable of receiving a query parameter called sessionId

Maya Mini App Endpoints

Endpoint/s you will need to manage the customer session in Maya Mini App.

NameHTTP MethodKey TypeEndpointDescription
Refresh TokenPOSTBearer Auth/tokensGenerate a new Customer Access Token (accessToken) and a new Customer Refresh Token (refreshToken)

Business Rules to Code

To supplement your knowledge of the integration, it is essential to know the Business Rules to Code for Maya Mini Apps . This ensures that technology requirements and other development considerations are met.


At this point, you have understood the following:

  • The necessary APIs and their endpoints
  • The sequence and purpose of each API
  • The prerequisites for building your integration



Frequently Asked

What to do when customer's accessToken expires?

Answer: Your platform must request to generate a new Customer Access Token (accessToken) from the Maya endpoints. See the Manage Mini App Session: Expired Customer Session for more details.