paypal api python code example

Example 1: paypal sdk python

pip install paypalrestsdk

Example 2: paypal create product php

$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'https://api.sandbox.paypal.com/v1/catalogs/products');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name": "Test Recurring","type": "SERVICE}');
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: '.$accessToken->token_type.' '.$accessToken->access_token.'';
$headers[] = 'Paypal-Request-Id: <your client id>';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
$createProduct = json_decode($result);

Tags:

Php Example