PHP code example of wegetfinancing / php-sdk

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

    

wegetfinancing / php-sdk example snippets


    
    
    Financing\SDK\Client;
    use WeGetFinancing\SDK\Entity\Request\AuthRequestEntity;
    use WeGetFinancing\SDK\Entity\Request\LoanRequestEntity;
    

    $auth = AuthRequestEntity::make([
        'username' => '***',
        'password'  => '***',
        'merchantId' => '***',
        'url' => 'https://***'
    ]);
    
    $client = Client::Make($auth);
    

    $request = LoanRequestEntity::make([
        'first_name' => '***',
        'last_name' => '***',
        'shipping_amount' => 1.2,
        'version' => '1.9',
        'email' => '***@example.com',
        'phone' => '0123456789',
        'merchant_transaction_id' => '***',
        'success_url' => 'https://yoururl.com/successurl',   // this is facultative
        'failure_url' => 'https://yoururl.com/failureurl',   // this is facultative
        'postback_url' => 'https://yoururl.com/postbackurl', // this is facultative
        'billing_address' => [
            'street1' => '***',
            'city' => '***',
            'state' => '***',
            'zipcode' => '***',
        ],
        'shipping_address' => [
            'street1' => '***',
            'city' => '***',
            'state' => '***',
            'zipcode' => '***',
        ],
        'cart_items' => [
            [
                'sku' => '***',
                'display_name' => '***',
                'unit_price' => '***',
                'quantity' => ***,
                'unit_tax' => **.*,
                'category' => '***',      // Facultative
            ]
        ]
    ]);
    

    $response = $client->requestNewLoan($request);
    
bash
composer