Integrating with PerksWallet
This guide provides a detailed walkthrough for integrating PerksWallet into your product. Whether you're using our APIs or JavaScript SDKs, this document outlines the necessary steps for a smooth integration.
Before you begin, ensure the following:
- PerksWallet must be enabled for your account. Contact your MomentScience account manager to activate it.
- You need an API Key with access to "PerksWallet." Refer to API Key Documentation to learn how to obtain one.
The pub_user_id is a unique, non-PII identifier for each user. It plays a critical role in linking offers to individual users.
- Ensure the pub_user_idremains consistent across sessions and devices.
- Do not use personally identifiable information (PII) such as email addresses or phone numbers.
- You can generate this identifier using any logic, as long as itβs unique for each user.
The pub_user_idis a required field in all requests and is essential for saving and retrieving offers.
ο»ΏYou can integrate PerksWallet into your product using one of the following methods: ο»Ώ
- Perkswall API
- Moments API
- Moments JS SDK
- Perkswall SDK
The core requirement for all integrations is providing a pub_user_id, a stable user identifier that allows offers to be saved and retrieved across sessions and devices.
When integrating with Perkswall API or Moments API, the process is the same. The key step is ensuring the pub_user_idis included in the request body for both saving and retrieving offers.
Moments API
Perkswall API
- Add the following script before the closing </head> tag
- ο»Ώ
- Add the container where the widget will be rendered:
- ο»Ώ
- Add the following script before the closing </body> tag
- ο»Ώ
When a user wants to save an offer for later, they can click the "Save for Later" CTA within the PerksWallet experience.
ο»ΏTo save offers via the Moments API or Perkswall API, follow these steps:ο»Ώ
- Include the pub_user_idin the API request body.
- Extract save_for_later_urlfrom the API response (offers[].save_for_later_url).
- On CTA click, make a POST request to save_for_later_url.
Once the POST request is made, the offer is saved to the userβs wallet and can be retrieved later using the same pub_user_id.
If pub_user_idis missing in the request body, save_for_later_url will be null.
If you are using the SDK, the saving process is automatically handled.
- The SDK automatically saves the offer when a user clicks the "Save for Later" button within a PerksWallet experience.
- The saved offer is linked to the pub_user_idyou provided during integration.
To fetch offers saved by a user, use the following API endpoint. This applies whether you're integrating via the Moments API or Perkswall API.
- HTTP Method: GET
Path Parameters:
Parameter | Type | Description |
---|---|---|
pub_user_id | String | The unique identifier of the user whose wallet you want to retrieve. |
Header Parameter
Parameter | Type | Description |
---|---|---|
pwaas-api-key | String | API key with access permission to PerksWallet. Required to authenticate and authorize the request. |
Response Parameters
Parameter | Type | Description |
---|---|---|
data | array | List of saved offers for the user. If no offers are saved, this will be an empty array. |
data[].id | integer | Unique ID of the saved offer. |
data[].user_id | string | Unique identifier for the user who saved the offer. |
data[].campaign_id | string | ID of the campaign associated with the offer. |
data[].publisher_id | string | The publisher's ID from which the user saved the offer |
data[].session_id | string | Unique session identifier when the offer was saved. |
data[].converted_at | string/null | Timestamp of when the offer was claimed (if applicable). Returns nullif not yet claimed. |
data[].created_at | string | Timestamp of when the offer was saved, in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). |
data[].updated_at | string | Timestamp of the last update to the saved offer record. |
data[].campaign | object | Details of the campaign associated with the saved offer. |
data[].campaign.id | integer | Unique campaign ID. |
data[].campaign.advertiser_name | string | Name of the advertiser providing the offer. |
data[].campaign.description | string | Full description of the offer. |
data[].campaign.short_description | string | Shorter version of the offer description. |
data[].campaign.headline | string | Primary offer headline. |
data[].campaign.short_headline | string | A more concise version of the headline. |
data[].campaign.positive_cta | string | Call-to-action text for the offer (e.g., "Start My Free Trial"). |
data[].campaign.primary_creative | string | URL to the primary creative (image) of the offer. |
data[].campaign.is_active | boolean | Indicates whether the offer is still active (true or false). |
data[].click_url | string | URL to claim the offer. |
Add this container element where you want the Saved Offers widget to appear
- Add this container element where you want the Saved Offers widget to appear
- ο»Ώ
- Add the following script before the closing </body>tag
- ο»Ώ
To delete a saved offer, use the following API request:
- HTTP Method: DELETE
Path Parameters:
Parameter | Type | Description |
---|---|---|
pub_user_id | String | The unique identifier of the user requesting deletion. |
campaign_id | String | The ID of the offer the user wants to remove. |
Header Parameter
Parameter | Type | Description |
---|---|---|
pwaas-api-key | String | API key with access permission to PerksWallet. Required to authenticate and authorize the request. |
If the request is successful, the API will return a confirmation message indicating the offer has been deleted.
If you are implementing using the SDK, deletion is handled automatically.
- The user will see a delete icon next to each saved offer.
- Upon clicking the icon, a confirmation message will appear.
- If the user confirms, the offer will be deleted from their saved list.
π’ If you're running into any issues while going through the integration process, feel free to contact us at [email protected]ο»Ώ