PHP code example of kurilovvo / rest-api-sdk-php

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

    

kurilovvo / rest-api-sdk-php example snippets


{
  ...

  "name": "sample/website",
  "
  ...
}

    define('PP_CONFIG_PATH', /path/to/your/sdk_config.ini);


use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Api\Payment;


   $apiContext = new ApiContext(new OAuthTokenCredential('<clientId>', '<clientSecret>'));

    $payment = new Payment();

    $payment->setIntent("Sale");

    ...

    $payment->create($apiContext);

      *OR*

    $payment = Payment::get('payment_id', $apiContext);