PHP code example of jeffersongoncalves / laravel-partnerstack

1. Go to this page and download the library: Download jeffersongoncalves/laravel-partnerstack library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersongoncalves / laravel-partnerstack example snippets


// config/partnerstack.php
return [
    'public_key' => env('PARTNERSTACK_PUBLIC_KEY'),
    'secret_key' => env('PARTNERSTACK_SECRET_KEY'),
    'base_url' => env('PARTNERSTACK_BASE_URL', 'https://api.partnerstack.com/api/v2'),
];

use JeffersonGoncalves\PartnerStack\Exceptions\PartnerStackException;
use JeffersonGoncalves\PartnerStack\Facades\PartnerStack;

PartnerStack::listPartnerships(['limit' => 50, 'order_by' => 'created_at']);

PartnerStack::listPartnerships();
PartnerStack::getPartnership('partnership-key');

PartnerStack::createPartnership([
    'email' => '[email protected]',
    'group_key' => 'group-key',
    'first_name' => 'Jane',
    'last_name' => 'Doe',
]);

PartnerStack::updatePartnership('partnership-key', ['name' => 'Jane Doe']);

PartnerStack::listCustomers();
PartnerStack::getCustomer('customer-key');

PartnerStack::createCustomer([
    'email' => '[email protected]',
    'partner_key' => 'partner-key',
    'customer_key' => 'your-internal-id',
]);

PartnerStack::updateCustomer('customer-key', ['name' => 'John Doe']);
PartnerStack::deleteCustomer('customer-key');

PartnerStack::listTransactions();
PartnerStack::getTransaction('transaction-key');

PartnerStack::createTransaction([
    'customer_key' => 'customer-key',
    'amount' => 4990,
    'currency' => 'usd',
    'category' => 'subscription',
]);

PartnerStack::deleteTransaction('transaction-key');

PartnerStack::listDeals();
PartnerStack::getDeal('deal-key');

PartnerStack::createDeal([
    'partner_key' => 'partner-key',
    'name' => 'Acme Corp',
    'amount' => 250000,
    'stage' => 'proposal',
]);

PartnerStack::updateDeal('deal-key', ['stage' => 'won', 'status' => 'closed']);
PartnerStack::archiveDeal('deal-key');

PartnerStack::listActions();

PartnerStack::createAction([
    'customer_key' => 'customer-key',
    'key' => 'signup',
    'value' => 1,
]);

PartnerStack::listRewards();

PartnerStack::createReward([
    'partner_key' => 'partner-key',
    'amount' => 10000,
    'description' => 'Q1 bonus',
    'currency' => 'usd',
]);

PartnerStack::listLeads();
PartnerStack::getLead('lead-key');

PartnerStack::createLead([
    'partner_key' => 'partner-key',
    'email' => '[email protected]',
    'company' => 'Acme Corp',
]);

PartnerStack::updateLead('lead-key', ['status' => 'qualified']);

PartnerStack::listGroups();

PartnerStack::listWebhooks();
PartnerStack::getWebhook('webhook-key');

PartnerStack::createWebhook([
    'target' => 'https://example.com/hooks/partnerstack',
    'events' => ['customer.created', 'transaction.created'],
]);

PartnerStack::deleteWebhook('webhook-key');

try {
    $partnership = PartnerStack::getPartnership('partnership-key');
} catch (PartnerStackException $e) {
    // $e->getMessage()  — the API's error message, or the raw response body
    // $e->statusCode    — the HTTP status code returned by PartnerStack
}
bash
php artisan vendor:publish --tag="partnerstack-config"
bash
composer analyse