Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Get Blank array when want to get all Payment details. #1340

Open
ManishPalawat opened this issue Feb 10, 2020 · 0 comments
Open

Get Blank array when want to get all Payment details. #1340

ManishPalawat opened this issue Feb 10, 2020 · 0 comments

Comments

@ManishPalawat
Copy link

ManishPalawat commented Feb 10, 2020

Here is my code::

use PayPal\Api\Amount;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Transaction;
use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
use PayPal\Api\WebProfile;
require 'vendor/autoload.php';

function getApiContext($clientId, $clientSecret, $enableSandbox = false){
    $apiContext = new ApiContext(
        new OAuthTokenCredential($clientId, $clientSecret)
    );

    $apiContext->setConfig([
        'mode' => $enableSandbox ? 'sandbox' : 'live'
    ]);

    return $apiContext;
}

function PaymentDetails(){
$enableSandbox = true;
$paypalConfig = [
'client_id' => 'AXgPCLPPJLxTY6hIvoGkcbTnuhAXMvS41fHQ3eq7tggCeCFMoEdU_yu-E5I5wlzSSTdtViQen23ZYISZ',
'client_secret' => 'XXXXXXXz32yzrsSFHr6s9cihjFBcRxAMll53_ZMn4JPO2rbnBgWO1GttAtVEEJD2uNS8J06lIsh2tVBb'
];
$apiContext = getApiContext($paypalConfig['client_id'], $paypalConfig['client_secret'], $enableSandbox);

  $list = WebProfile::get_list($apiContext);
  print_r($list);
  
  $params = array('count' => 20,'start_index' => 0);
  $response = Payment::all($params,$apiContext);
  print 'hello';
  print_r($response->payments);

}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant