PHP code example of subster / php-sdk

1. Go to this page and download the library: Download subster/php-sdk 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/ */

    

subster / php-sdk example snippets


use Subster\PhpSdk\SubsterConnector;
use Subster\PhpSdk\DataObjects\CreateCheckoutSessionData;

$subster = new SubsterConnector('your-api-key');

$session = $subster->checkoutSessions()->create(
    CreateCheckoutSessionData::from([
        'customer' => 'customer-id',
        'items' => [
            [
                'plan' => 'your-plan-id',
            ],
        ],
        'success_url' => 'https://example.ru/success',
        'cancel_url' => 'https://example.ru/cancel',
    ])
);

use Subster\PhpSdk\SubsterConnector;
use Subster\PhpSdk\DataObjects\CreateBillingPortalSessionData;

$subster = new SubsterConnector('your-api-key');

$session = $subster->billingPortalSessions()->create(
    CreateBillingPortalSessionData::from([
        'customer' => 'customer-id',
        'return_url' => 'https://example.ru/billing',
    ])
);
bash
composer