WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › Hook After Purchase
- This topic has 3 replies, 2 voices, and was last updated 6 years, 9 months ago by
Shadow Labs.
-
AuthorPosts
-
July 23, 2019 at 8:49 pm #4805
squiggie
ParticipantI’d like to develop a way where I could notify users of a twitch stream when an affiliate purchase happens. Is there a way to do this? Is there an api endpoint that could be monitored or hook that could be fired to throw an alert within streamlabs that would allow this to happen.
I’m mainly looking for a way to throw an alert when an affiliate purchase happens.
Frankly I’m not even sure how to go about starting this but looking for ideas on how to get this to happen.
July 24, 2019 at 4:24 am #4806Shadow Labs
Keymaster@squiggie, We do have an action hook that can be triggered to reward a commission to an affiliate: https://wpaffiliatemanager.com/api-track-commission-via-a-wordpress-hook/
July 24, 2019 at 1:45 pm #4807squiggie
ParticipantI’m struggling to see how this all might tie together. Can you help me visualize the process or walk through the process?
A custom wordpress plugin/app allows affiliates to OAuth to the StreamLabs API and stores their access token and twitch username in the WordPress DB
A Custom Field on the affiliate registration page would allow an affiliate to enter their Twitch Username thus allowing us to associate that twitch username with the access token granted above. I’m assuming these custom fields are stored in the wordpress database right?
—
A user comes to the site based on an affiliate link
They purchase a product
The do_action(‘wpam_process_affiliate_commission’, $args); is triggered
I get the affiliate id by getting it from the cookie $aff_id = $_COOKIE[‘wpam_id’];
With the affiliate_id, I query the custom fields to get the access to twitch username above
With the twitch username, I query the db to get the Streamlabs access token
With the token, I send a request to the StreamLabs api with the Alert Box InformationDoes this make sense? Are my assumptions about the Custom Affiliate Fields correct and are they stored in the DB?
July 25, 2019 at 5:30 am #4809Shadow Labs
Keymaster@squiggie, It should work since the custom field value is saved in the database.
-
AuthorPosts
- You must be logged in to reply to this topic.