POST apply


{{domainAddress}}
/promoCode/apply

This function will apply the promo code to the user’s account.

Note: The response to this function is irrelevant to the mobile app and should be ignored, even if it fails.

Revisions:

Headers

HeaderContent
Content Typeapplication/json
AuthorizationBearer {{ID token}}
App-Id{{API key provided by Mosaic}}
Device-Id{{Advertising ID from the initial installation of this app}}
Request-Date{{ISO 8601 date and time format in UTC}}

Body

Variable Contents
ParameterDescription
{{clientId}} Is provided by CWF for the app project and will be consistent throughout all API calls that require this ID.
Type: String; Required
{{promoCode}}Provided by the app input form.
Type: String; Required ; Max Length: 10 chars
{{userId}}Available from getUser() response data.
Type: String; Required
{{promoCodeToken}}This value is provided in response to the /promoCode/test query. 
When submitting transaction requests that include the above promoCode parameter, this parameter needs to be included as well.
Type: String; Optional 
{{eventType}}Informs the API which user interaction has resulted in this API query.
Type: String; Required
{{source}}Informs the API which UI has sent the query.
Type: String; Required
{
  "clientId":"{{clientId}}",
  "promoCode":"{{promoCode}}",
  "promoCodeToken":"{{promoCodeToken}}",
  "userId":"{{userId}}",
  "eventType":"promo_applied",
  "source":"profile"
 }

Developer Note: Since this query is currently made from only one location in the mobile apps (the Profile screen), the eventType and source values can be hard coded to match the example below.

Example

Headers
App-Id: 5***9-d**3-4**8-b**1-b3***dac
Device-Id: a4***cb-d***5-4***f-8***c-84***75
Request-Date: 2024-07-02T19:59:20.815Z
Content-Type: application/json
Authorization: Bearer eyJraWQiO...aLxlc6PCgQ
Body
{
    "clientId":"1f6w1jh6ls3mb",
    "promoCode":"SL838F22",
    "promoCodeToken":"TOKEN_GOES_HERE",
    "userId":"03af191d-70d2-472e-9ac0-149cx2437f9d",
    "eventType":"promo_applied",
    "source":"profile"
}

Response

{
    "errors": [],
    "warnings": [
        "Validator: 4 values were removed from the provided request data"
    ],
    "notices": [],
    "data": {
        "message": "success"
    }
}

Developer:

The contents of the response are irrelevant to the mobile apps at this time. The response can be ignored. What is important is that the query is made. All other aspects of the functionality happen on the server side, and no further interaction is required on the client side.