{"id":16233491,"url":"https://github.com/karser/affiliates-api","last_synced_at":"2025-04-08T07:36:37.530Z","repository":{"id":148328147,"uuid":"306349899","full_name":"karser/affiliates-api","owner":"karser","description":"Rest API for Itthinx Affiliate WordPress Plugin","archived":false,"fork":false,"pushed_at":"2020-10-22T14:05:39.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T04:47:57.839Z","etag":null,"topics":["affiliate","affiliate-program","referral","referral-program","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-22T13:41:00.000Z","updated_at":"2024-03-06T02:37:14.000Z","dependencies_parsed_at":"2023-05-19T19:30:41.024Z","dependency_job_id":null,"html_url":"https://github.com/karser/affiliates-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2Faffiliates-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2Faffiliates-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2Faffiliates-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karser%2Faffiliates-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karser","download_url":"https://codeload.github.com/karser/affiliates-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247797353,"owners_count":20997725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["affiliate","affiliate-program","referral","referral-program","wordpress-plugin"],"created_at":"2024-10-10T13:12:50.936Z","updated_at":"2025-04-08T07:36:37.511Z","avatar_url":"https://github.com/karser.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rest API for Itthinx Affiliate WordPress Plugin\n\n## How it works:\n\n### 1. Define the api key in wp-config.php\n\n```\nif ( !defined('AFFILIATE_WP_API_KEY') ) {\n    define('AFFILIATE_WP_API_KEY', 'define-your-api-key-here');\n}\n```\n\n### 2. Save the hit hash and referrer id from cookie during registration\n\nThis may happen when the user submits the registration form so this code checks for the affiliate cookies and sends them back to the server along with the registration data\n\n```\nfunction getRefTrackingId(): string {\n    const affId = CookieStorage.getItem('wp_affiliates');\n    const hit = CookieStorage.getItem('_h_affiliates');\n    if (isDefined(affId) \u0026\u0026 isDefined(hit)) {\n        return `${affId}|${hit}`;\n    }\n    return null;\n}\n```\n\n### 3. Submit a purchase back to the plugin\n\n```\nPOST /wp-json/affiliates-api/referrals HTTP/1.1\nHost: your-host.com\nContent-Type: application/json\nX-Api-Key: your-key\n{\n  \"email\":\"joe@email.com\",\n  \"baseAmount\":\"100\",\n  \"currency\":\"USD\",\n  \"refId\":\"5\",\n  \"date\":\"2012-01-01T10:01:01Z\",\n  \"hit\":\"c096876aa6517e2c6d5198efa6a4037532dc1f97959963689c8b6bf3bba17c2f\",\n  \"reference\":\"txn_16A3XQSE2ez0wdde\",\n  \"ip\":\"158.217.93.151\"\n}\n```\n\n## Troubleshooting\n\n### Share cookie between subdomain and domain\nif the wordpress and your app are on different subdomains\n(e.g your-domain.com and app.your-domain.com)\ntry adding a leading dot to the cookie settings:\n```\ndefine( 'COOKIE_DOMAIN', '.your-domain.com' );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarser%2Faffiliates-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarser%2Faffiliates-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarser%2Faffiliates-api/lists"}