Partnero PHP SDK
- Installation
- Usage
- Partners API
- Customers API
- Transactions API
- Webhooks API
- Referrals API
- Get a list of referrals
- Create referring customer
- Create referred customer
- Get referral customer
- Get list of referred customers
- Get stats of referral customer
- Search referral customer
- Update referral customer
- Delete referral customer
- Invite referral customer via email
- Get referral customer balance
- Credit referral customer balance
- Subscribers API
- Support and Feedback
- PHP 8.0
- PSR-7 and PSR-18 based HTTP adapter
- Partnero API key partnero.com
This library is built atop of PSR-7 and PSR-18.
composer require partnero/partnero-php
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->partners()->list(10);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->partners()->find('partner-key');
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$partner = (new Partner())
->setEmail('test@mail.com')
->setName('Name')
->setKey('partner-key');
$partnero->partners()->create($partner);
Key is optional.
If key is not set, a random key will be generated for the partner.
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$partner = (new Partner())
->setEmail('john.doe@mail.com')
->setName('John')
->setKey('john-doe');
$partnero->partners()->update('partner-key', $partner);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->partners()->delete('john-doe');
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$partner = (new Partner())
->setKey('partner-key');
$partnero->customers()->list(10, $partner);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->customers()->find('customer-key');
use Partnero\Partnero;
use Partnero\Models\Partner;
use Partnero\Models\Customer;
$partnero = new Partnero('api_key');
$partner = new Partner();
$partner->setKey('partner-key');
$customer = (new Customer())
->setKey('customer-key')
->setName('Name')
->setEmail('customer@mail.com');
$partnero->customers()->create($customer, $partner);
use Partnero\Partnero;
use Partnero\Models\Customer;
$partnero = new Partnero('api_key');
$customer = (new Customer())
->setKey('new-customer-key')
->setName('John')
->setEmail('customer.john.doe@mail.com');
$partnero->customers()->update('customer-key', $customer);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->customers()->delete('new-customer-key');
use Partnero\Partnero;
use Partnero\Models\Customer;
use Partnero\Models\Transaction;
$partnero = new Partnero('api_key');
$customer = (new Customer())
->setKey('customer-key');
$transaction = (new Transaction())
->setKey('transaction_123')
->setAmount(99.99)
->setAction('sale');
$partnero->transactions()->create($transaction, $customer);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->transactions()->delete('transaction_123');
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->webhooks()->list(50, 1);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->webhooks()->find('webhook-key');
use Partnero\Partnero;
use Partnero\Models\Webhook;
$partnero = new Partnero('api_key');
$webhook = (new Webhook())
->setName('Demo')
->setUrl('https://webhook.site/e68d154a-ad82')
->setEvents([
'partner.created'
]);
$partnero->webhooks()->create($webhook);
use Partnero\Partnero;
use Partnero\Models\Webhook;
$partnero = new Partnero('api_key');
$webhook = (new Webhook())->setName('Demo 2');
$partnero->webhooks()->update('webhook-key', $webhook);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->webhooks()->delete('webhook-key');
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->list(50, 1, 'referred')
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$customer = (new Partner())
->setId('partner-id')
->setName('John Doe')
->setEmail('john.doe@email.com');
$partnero->referrals()->createReferring($customer);
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$customer = (new Partner())
->setId('partner-id')
->setName('Jean Doe')
->setEmail('jean.doe@email.com');
$referringCustomer = (new Partner())
->setKey('partner-key');
$partnero->referrals()->createReferred($customer, $referringCustomer)
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->find('partner-id');
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->listReferred('partner-id');
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->stats('partner-id');
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->search(['id' => 'partner-id']);
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$newCustomer = (new Partner())
->setName('Mark Doe');
$partnero->referrals()->update('partner-id', $newCustomer);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->delete('partner-id');
use Partnero\Partnero;
use Partnero\Models\Partner;
$partnero = new Partnero('api_key');
$customer = (new Partner())
->setEmail('john.doe@email.com');
$partnero->referrals()->invite($customer, [
'personalization_key_1' => 'personalization_value_1',
'personalization_key_2' => 'personalization_value_2'
]);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->referrals()->balance('partner-id');
use Partnero\Partnero;
use Partnero\Models\BalanceCredit;
$partnero = new Partnero('api_key');
$credit = (new BalanceCredit())
->setAmount(10)
->setAmountUnits('usd')
->setIsCurrency(true);
$partnero->referrals()->credit('partner-id', $credit);
use Partnero\Partnero;
use Partnero\Models\Subscriber;
$partnero = new Partnero('api_key');
$partnero->subscribers()->list();
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->subscribers()->find('subscriber-identifier-or-email');
use Partnero\Partnero;
use Partnero\Models\Subscriber;
$partnero = new Partnero('api_key');
$subscriber = (new Subscriber())
->setName('Referral subscriber')
->setEmail('referral@subscriber.com')
->setApproved(true)
->setStatus('active')
->setTos(true)
->setMarketingConsent(true);;
$singleSubscriber = $partnero->subscribers()->create($subscriber);
// If you want to create a referred subscriber
$referredSubscriber = (new Subscriber())
->setName('Referred Subscriber')
->setEmail('referred@subscriber.com')
->setApproved(true)
->setStatus('active')
->setTos(true)
->setMarketingConsent(true);
$partnero->subscribers()->create($referredSubscriber, $singleSubscriber);
NOTE: To create a referred subscriber, pass the parent subscriber as the second argument. If you’re using a response like the one in the example above, make sure to extract the necessary data from the response (e.g., $singleSubscriber['body']['data']).
Alternatively, instead of passing the entire model as a second argument, you can pass the parent subscriber’s identifier or email as an array, for example:
$partnero->subscribers()->create($referredSubscriber, ['email' => 'referral@subscriber.com']).
use Partnero\Partnero;
use Partnero\Models\Subscriber;
$partnero = new Partnero('api_key');
$subscriber = (new Subscriber())
->setIdentifier('new-subscriber-esp-identifier')
->setName('John Surname')
->setEmail('subscriber.john.doe@mail.com')
->setApproved(true)
->setStatus('active')
->setTos(false)
->setMarketingConsent(false);
$partnero->subscribers()->update('subscriber-identifier-or-email', $subscriber);
use Partnero\Partnero;
$partnero = new Partnero('api_key');
$partnero->subscribers()->delete('subscriber-identifier-or-email');
In case you find any bugs, submit an issue directly here in GitHub.
If you have any troubles using our API or SDK feel free to contact our support by email hello@partnero.com
The official documentation is at https://developers.partnero.com