我正在尝试使用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
任何人都有任何想法或建议吗?