0

我正在 iOS 应用程序中实施 PayPal 付款。我需要将钱从客户转移到商家帐户,因此我使用旧的 MPL SDK 和自适应支付。所有作品。现在我需要在服务器端验证付款。为此,我使用PaymentDetailsAPI 方法(API 参考)。但它总是返回一个错误:

Authentication failed. API credentials are incorrect.

我在http://www.paypal-apps.com上创建了一个应用程序,并在我的 PayPal 个人资料中请求了 API 凭据。我已经尝试过使用高级帐户和商业帐户。但仍然没有结果。

4

1 回答 1

0

When you switch from Live to Sandbox and the other way around you should care for the config of the mode.

Sadly I did this all in PHP, not with MPL SDK but this piece of code might be the right hint to you:

LIVE:

$apiContext = new \PayPal\Rest\ApiContext(
  new \PayPal\Auth\OAuthTokenCredential('XXXXXXXXX...XXXXXXXXXX','YYYYYYY...YYYYYYYYY')
);  
$apiContext->setConfig( array('mode' => 'live') );

SANDBOX:

$apiContext = new \PayPal\Rest\ApiContext(
  new \PayPal\Auth\OAuthTokenCredential('xxxxxxxxx...xxxxxxxxxx','yyyyyyyyyy...yyyyy')
);  
$apiContext->setConfig(array('mode' => 'sandbox'));

Do not forget to set your Mode according to your credentials (Secret Key). Paypal does not recognize the type of secret-key by its own.

于 2015-10-01T16:19:49.310 回答