我想获取我的PayPal帐户的所有交易记录,在转换为PHP后,我用以下代码在Paypal Sync Api文档中使用Bash命令找到了一些帮助。
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paypal.com/v1/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_USERPWD => "*****",
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_POSTFIELDS => "grant_type=client_credentials",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = json_decode(curl_exec($curl));
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paypal.com/v1/reporting/transactions?start_date=2019-01-15T00:00:00-0700&end_date=2019-02-02T00:00:00-0700&fields=all&page_size=100&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer ".$response->access_token
),
));
print_r(json_decode(curl_exec($curl)));
curl_close($curl);
贝宝(Paypal)有一个PHP SDK,因此应该有可能在链接的SDK上完全相同
https://github.com/paypal/PayPal-PHP-SDK
,SDK有点复杂,我在交易中发现的唯一一件事就是计费计划。 因此,有人已经获得了使用该SDK的所有交易的清单吗? 预先感谢