Registrar Nuevos Promotores vía API
Aprende a registrar nuevos promotores en tu programa de referidos utilizando de Genius Referrals RESTful API. Registrar nuevos promotores en la Plataforma de Genius Referrals es un proceso sencillo y eficiente. A continuación, te mostramos cómo hacerlo de manera efectiva.
Requisitos Previos
<?php
require_once "../vendor/autoload.php";
$contentType = "application/json"; // The content type
$xAuthToken = "2f266b71bn8038e674bka93b62f92857778k5c1cf45d"; // Your API Token, you can get your token here https://app.geniusreferrals.com/en/settings/api-access
$accountSlug = 'sandbox';
$client = new GeniusReferralsLib\GeniusReferralsClient($contentType, $xAuthToken);
$advocates = $client->getAdvocates();
// Preparing data needed to sent on the request
$advocate = new \GeniusReferralsLib\Models\Advocate();
$advocate->name = 'John';
$advocate->lastname = 'Doe';
$advocate->email = 'john.doe@example.com';
$advocate->payoutThreshold = 1;
$advocate->canRefer = 1;
// New advocate successfully created
$newAdvocate = $advocates->postAdvocate($accountSlug, new \GeniusReferralsLib\Models\AdvocateForm($advocate));
// Adding the currency to the advocate
$advocatePatchForm = new \GeniusReferralsLib\Models\AdvocatePatchForm();
$advocatePatchForm->currencyCode = 'USD';
// Advocate currency successfully added to the advocate
$updatedAdvocate = $advocates->patchAdvocate($accountSlug, $newAdvocate->token, $advocatePatchForm);