# Testing the API with a webview source: https://developer.mastercard.com/mastercard-benefits-and-experiences-portal/documentation/tutorials-and-guides/test-webview/index.md ## Prerequisites {#prerequisites} You will need to [install and configure Insomnia](https://developer.mastercard.com/mastercard-benefits-and-experiences-portal/documentation/tutorials-and-guides/test-api-insomnia/index.md) or any other API testing tool. In this tutorial, you will first make a request to an API endpoint from that tool to generate a token. You will then use your browser to emulate the webview behavior. ## Testing {#testing} Consumers see a web page or an embedded webview with a list of benefits they can select. They interact with the page hosted on Priceless, so there is no need to make direct API calls for searching and personalization. #### Step 1. Create an SSO token. {#step-1-create-an-sso-token} Make a POST call: `POST https://api.mastercard.com/the-portal/user-tokens` ```json { "payment": { "creditCard": { "cardHolderName": "Oxana Doe", "cardNumber": "5545000000007675", "expirationMonth": 5, "expirationYear": 2023 } }, "countryCode": "US", "firstName": "Oxana", "lastName": "Doe", "partnerUUID": "123456", "segmentCode": "LoungeKFM2", "preferredLanguageCode": "en-US", "emailAddress": "oxana.doe@mastercard.com", "partnerId": 484, "billingAddress": { "countryCode": "us", "firstName": "Oxana", "lastName": "Doe", "addressLine1": "25 Highland Way", "city": "Boston", "stateName": "Massachusetts", "postalCode": "02115", "phone": 441132431751 } } ``` ```json { "msg": "OK", "data": { "accessToken": "G9r8fWFZ67VrGoAqa7gL" } } ``` You now have the `accessToken` which is essentially a session ID to pass to a web page URL. #### Step 2. Open a webview to let the cardholder browse benefits. {#step-2-open-a-webview-to-let-the-cardholder-browse-benefits} Call the following URL: `https://www.priceless.com/globalbenefit/s/{source_id}?access_token={access_token}&partner_id={partner_id}` where you need to replace the following variables: * `partner_id` - your partner ID provisioned by Mastercard * `source_id` - the source assigned to your landing page at onboarding, along with your `partner_id` * `access_token` - the SSO token generated by the `user-tokens` endpoint above. Note: For a mobile webview with a resized responsive page, add `/m` after the domain name, e.g.: `https://www.priceless.com/m/globalbenefit/s/{source_id}?access_token={ACCESS_TOKEN}&partner_id={partner_id}` We will use `partner_id = 484` and `source_id = 11433` in this example: `https://www.priceless.com/globalbenefit/s/11433?access_token=G9r8fWFZ67VrGoAqa7gL&partner_id=484` The cardholder will see a welcome note with their details in their preferred language: ![Benefits portal welcome note](https://static.developer.mastercard.com/content/mastercard-benefits-and-experiences-portal/uploads/webview_step1.png) After pressing **Choose your benefits**, the cardholder will see a list of available benefits: ![Browse benefits](https://static.developer.mastercard.com/content/mastercard-benefits-and-experiences-portal/uploads/webview_step2.png) They can press **Learn more** to read the description of each benefit. If they are ready to select that benefit, they will press **Select benefit**: ![Read benefit description](https://static.developer.mastercard.com/content/mastercard-benefits-and-experiences-portal/uploads/webview_step3.png) The cardholder needs to confirm their benefit selection: ![Confirm benefit selection](https://static.developer.mastercard.com/content/mastercard-benefits-and-experiences-portal/uploads/webview_step4.png) The page will now acknowledge their selections with a message: ![Benefit selection success](https://static.developer.mastercard.com/content/mastercard-benefits-and-experiences-portal/uploads/webview_step5.png) The cardholder's selections will be registered in the Loyalty database.