PayPal PHP SDK API - Get all Transactions -
i want use paypal php sdk api list payments/transactions. sandbox credentials i`m successfully, if switch live credentials result just:
{ "count": 0 }
...yes im switching live with:
$apicontext->setconfig(array('mode' => 'live'));
what failure? here full code:
<?php // 1. autoload sdk package. include files , classes autoloader require __dir__ . '/autoload.php'; $apicontext = new \paypal\rest\apicontext( new \paypal\auth\oauthtokencredential( 'abc', // clientid 'def' // clientsecret ) ); $apicontext->setconfig(array('mode' => 'live')); #$apicontext = new \paypal\rest\apicontext( # new \paypal\auth\oauthtokencredential( # 'xyz', // clientid # 'xyzz' // clientsecret # ) #); // test //require 'createpayment.php'; //use paypal\api\payment; $payment = new \paypal\api\payment(); try { $params = array('count' => 10, 'start_index' => 0); $payments = $payment->all($params, $apicontext); echo $payments; } catch (exception $ex) { }
Comments
Post a Comment