我是一名管理员,拥有商业类型的PayPal帐户,我付费才能收到PayPal电子邮件ID。
问题是Paypal没有提供交易ID或交易详情。无法更改接收方paypal帐户设置。在这种情况下,付款人帐户只有一个,但接收者是多个。您只需在单个交易中向单个用户付款,因此无需使用自适应付款或更改付款。
请提供此代码的PHP代码,并帮助支付直接付款并获得回复。
请帮帮我。
先谢谢。
答案 0 :(得分:0)
<?php
$sender_batch_id = mt_rand(100000000000000,999999999999999);
$sender_item_id = mt_rand(100000000000000,999999999999999);
$access_token = 'A21AAGpxXlEt3iIG7fKiriFDdLwIW_JJvpOa9IwVb8XXJbeVjL9MkHvmYWbWkHgVReeiuEQaYZTbi6xSWbXGMlLaabJPwkdYg'; //Dummy
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true"); //DUMMY
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"sender_batch_header\":{\"sender_batch_id\":\"$sender_batch_id\",\"email_subject\":\"You have a payout!\",\"recipient_type\":\"EMAIL\"},\"items\":[{\"recipient_type\":\"EMAIL\",\"amount\":{\"value\":\"1.0\",\"currency\":\"USD\"},\"note\":\"Thanks for your patronage!\",\"sender_item_id\":\"$sender_item_id\",\"receiver\":\"sanjay@rudrainnovatives.com\" }]}"); //DUMMY
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Authorization: Bearer $access_token";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
pr(json_decode($result));
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
?>
此代码有助于使用Paypal Single Payout付款。