PerksWallet

Integrating with PerksWallet

23min

Overview

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.

Prerequisites

Before you begin, ensure the following:

  1. PerksWallet must be enabled for your account. Contact your MomentScience account manager to activate it.
  2. You need an API Key with access to "PerksWallet." Refer to API Key Documentation to learn how to obtain one.

Understanding pub_user_id

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.

ο»Ώ

Integrating Methods

ο»Ώ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.

Integration via API

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.

Try It Out

Moments API

ο»Ώ

Perkswall API

ο»Ώ

Integration via JavaScript SDK

Moments

  1. Add the following script before the closing </head> tag
    1. JS
      ο»Ώ

Perkswall

  1. Add the container where the widget will be rendered:
    1. JS
      ο»Ώ
  2. Add the following script before the closing </body> tag
    1. JS
      ο»Ώ
ο»Ώ

Saving an Offer

When a user wants to save an offer for later, they can click the "Save for Later" CTA within the PerksWallet experience.

Saving via API

ο»ΏTo save offers via the Moments API or Perkswall API, follow these steps:ο»Ώ

  1. Include the pub_user_idin the API request body.
  2. Extract save_for_later_urlfrom the API response (offers[].save_for_later_url).
  3. 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.

Saving via JavaScript SDK

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.
ο»Ώ

Retrieving User's Wallet

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.

Using the APIο»Ώ

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.

Example Response
ο»Ώ

Showing User's Wallet with SDK

Add this container element where you want the Saved Offers widget to appear

  1. Add this container element where you want the Saved Offers widget to appear
    1. JS
      ο»Ώ
  2. Add the following script before the closing </body>tag
    1. JS
      ο»Ώ
ο»Ώ

Deleting Saved Offers

Using the API

To delete a saved offer, use the following API request:

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.

Using SDK

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]ο»Ώ