gpt4 book ai didi

php - 有人可以帮助我进行 paypal 链接支付吗? PHP

转载 作者:太空宇宙 更新时间:2023-11-03 16:06:08 25 4
gpt4 key购买 nike

我对使用 Paypal 做任何事情都不熟悉,这让我很沮丧。我只是想在这里使用沙盒业务帐户创建链接支付:

$api = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";

$input = array(
"actionType" => "CREATE",
"currencyCode" => "USD",
"feesPayer" => "EACHRECEIVER",
"memo" => "TestNote",
"receiverList" => array(
"receiver" => array( //first goes to merchant(95% of payment)
"amount" => "95.00",
"email" => "rbxseller@gmail.com",
"primary" => true
),
"receiver" => array( //then sends 5% commission to owner of site
"amount" => "5.00",
"email" => "rbxowner@gmail.com",
"primary" => false
)
),
"requestEnvelope" => array(
"errorLanguage" => "en_US"
)
);

$headers = array(
"X-PAYPAL-SECURITY-USERID: ".USER_ID,
"X-PAYPAL-SECURITY-PASSWORD: ".USER_PASS,
"X-PAYPAL-SECURITY-SIGNATURE: ".USER_SIG,
"X-PAYPAL-REQUEST-DATA-FORMAT: NV",
"X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
"X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"
);

$ch = curl_init($api);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($input));
$response = curl_exec($ch);
var_dump($response);

我收到错误响应:

[{"errorId":"580001","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Invalid request: {0}"}]

感谢您花时间回复!

最佳答案

您不能简单地向 PayPal 端点提交一组数据。您需要为 Adaptive Payments 构建 XML 请求。

我建议您看看我的 PayPal PHP Class Library ,它的工作方式与您在这里尝试的工作方式非常相似,除了它会获取您的数组数据,生成 XML 请求,将其发送到 PayPal,解析 XML 结果并将数组返回给您。

它支持包括 Adaptive Payments 在内的所有 PayPal API,并附带功能齐全的示例以及现成的模板文件,可用于开始新的调用。

关于php - 有人可以帮助我进行 paypal 链接支付吗? PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42050777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com