我正在尝试将 Paypal 并行支付与 iOS 应用程序一起使用,在我发现 iOS sdk 不支持自适应支付之后,我决定将数据传递给一个 php 文件并让它为我处理并行支付,但我对 PHP 完全陌生。我已经成功地创建了一个 PHP 项目,安装了 composer,并用它来添加 "paypal/adaptivepayments-sdk-php":"2.*" 到我的项目中。我正在尝试使用他们的文档来创建付款,但我有点迷茫。到目前为止,这是我的代码:
<?php
require_once __DIR__ . '/vendor/autoload.php';
// Sets config file path(if config file is used) and registers the classloader
// Array containing credentials and confiuration parameters. (not required if config file is used)
// Array containing credentials and confiuration parameters. (not required if config file is used)
$config = array(
'mode' => 'sandbox',
'acct1.UserName' => 'jb-us-seller_api1.paypal.com',
'acct1.Password' => 'WX4WTU3S8MY44S7F'
);
$service = new AdaptivePaymentsService($config);
$payRequest = new PayRequest();
// Add optional params
if($_POST["feesPayer"] != "") {
$payRequest->feesPayer = $_POST["feesPayer"];
}
$response = $service->Pay($payRequest);
if(strtoupper($response->responseEnvelope->ack) == 'SUCCESS') {
// Success
}
它不断返回以下错误:
Fatal error: Uncaught exception 'PPInvalidCredentialException' with message 'Invalid userId ' in /Users/charlie/PhpstormProjects/AdaptivePaymentsTesting/vendor/paypal/sdk-core-php/lib/PPCredentialManager.php:120
有人有什么想法或建议吗?