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 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 https //docs momentscience com/apis documentation#yet9v 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 id remains 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 id is 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 id is included in the request body for both saving and retrieving offers try it out moments api perkswall api integration via javascript sdk moments add the following script before the closing \</head> tag \<script type="module"> (function (window) { // configure moments with your account settings window\ adpxconfig = { accountid 'fbe6000000f803ef4', // replace with your unique account id autoshow true // automatically show the moments widget when loaded }; // define the user object using a stable pub user id window\ adpxuser = { pub user id 'user 123' // replace with your unique user id }; })(window\ self !== window\ top ? window\ top window); (async function (window) { const target = window\ document head || window\ document body; const script = window\ document createelement('script'); script type = 'text/javascript'; script src = 'https //cdn pubtailer com/launcher min js'; script importance = 'high'; script crossorigin = 'anonymous'; script async = true; script id = 'adpx launcher'; target appendchild(script); await new promise(function (resolve) { window\ adpx ? resolve() window\ document getelementbyid('adpx launcher') addeventlistener('load', function () { resolve(); }); }); window\ adpx init(adpxconfig); })(window\ self !== window\ top ? window\ top window); \</script> perkswall add the container where the widget will be rendered \<div id="adpx container">\</div> add the following script before the closing \</body> tag \<script> window\ adpxconfig = { accountid "fbe6000000f803ef4", // replace with your account id themeid "standard theme", // replace with your theme id containerid "adpx container" }; window\ adpxuser = { // include user info here pub user id "user 123", // replace with your unique user id }; const adpx = document createelement('script'); adpx type = 'text/javascript'; adpx async = true; adpx src = 'https //cdn adspostx com/launcher perkswall js'; document getelementsbytagname('head')\[0] appendchild(adpx); \</script> 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 include the pub user id in the api request body extract save for later url from 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 id is 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 id you 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 http method get endpoint https //api perkswallet com/api/publisher/user/{{pub user id}}/saved/campaigns json https //api perkswallet com/api/publisher/user/%7b%7bpub user id%7d%7d/saved/campaigns json 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 null if 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 { "data" \[ { "id" 1000, "user id" "200", "campaign id" "100", "publisher id" "2222", "session id" "a21cec ", "converted at" null, "created at" "2025 04 03t10 47 27 404+00 00", "updated at" "2025 04 03t10 47 27 404+00 00", "campaign" { "id" 100, "advertiser name" "ancestry", "description" " ", "short description" " ", "headline" "discover your roots free ancestry trial!", "short headline" "discover your roots free trial!", "positive cta" "start my free trial", "mini text" "\<p>\<br>\</p>", "primary creative" "https // ", "is active" true, "last sync at" "2025 02 07t05 03 17 049z", "created at" "2025 02 07t05 03 17 049+00 00", "updated at" "2025 02 07t05 03 17 049+00 00" }, "click url" "https //trk pubtailer com/sdk/offer click?o id=4460\&c id=1753\&sess id=a21cec89008306ec70d4315f6d55a045ae8761fc\&p id=3065" } ] } showing user's wallet with sdk 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 \<div id="adpx container">\</div> add the following script before the closing \</body> tag \<script> window\ pwaasconfig = { accountid "fbe6000000f803ef4", // replace with your account id pub user id "user 123", // replace with your user's unique id themeid "standard theme", // optional use your own theme if available containerid "adpx container" }; const adpx = document createelement('script'); adpx type = 'text/javascript'; adpx async = true; adpx src = 'https //cdn adspostx com/launcher pwaas js'; document getelementsbytagname('head')\[0] appendchild(adpx); \</script> deleting saved offers using the api to delete a saved offer, use the following api request http method delete endpoint https //api perkswallet com/api/publisher/user/{{pub user id}}/saved/campaign/{{campaign id}} json https //api perkswallet com/api/publisher/user/{{pub user id}}/saved/campaign/{{campaign id}} json 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 help\@momentscience com