繁体   English   中英

Paypal自适应付款在沙盒模式下有效,但不能用于生产

[英]Paypal Adaptive Payments works in sandbox mode but not production

我正在尝试使用Paypal的自适应支付API,并且很难将其切换到生产环境。 在沙盒模式下,一切都按预期工作,并且我得到了正确的响应,但是当我切换到实时APP ID时,它不起作用。

这些是我用于沙箱的配置值

PayPal URL : https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?paykey=[TOKEN_HERE]
Application ID : APP-80W284485P519543T

这些值在沙盒模式下对我有用。 但是当我切换到以下生产值时,它停止工作

PayPal URL : https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=[TOKEN_HERE]
Application ID : [ACTUAL APP ID]

This is what I mean by stops working.
  • 在生产模式下,应用程序获取支付密钥
  • 将其附加到Paypal URL,然后将其重定向到他们的网站
  • 在网站加载时,我收到以下消息

This transaction has already been approved. Please visit your PayPal Account Overview to see the details

最终的网址以-https: https://ic.paypal.com/webapps/adaptivepayment/flow/payinit?execution=e6s1结尾

截图-http: //screencast.com/t/28qJZ9CIk

那里还有一个“返回”按钮,当我单击它时,我每次都会被带到另一个站点(就像我被发送到随机的failUrls一样)

我已经在下面包含了我使用的代码

$payRequest = new PayRequest();
$payRequest->actionType     = "PAY";
$payRequest->cancelUrl      = $cancelURL; //my success and fail urls
$payRequest->returnUrl      = $returnURL;

$payRequest->clientDetails  = new ClientDetailsType();
$payRequest->clientDetails->applicationId   = $this->config['application_id'];
$payRequest->clientDetails->deviceId        = $this->config['device_id'];
$payRequest->clientDetails->ipAddress       = $this->CI->input->ip_address();

$payRequest->currencyCode = $currencyCode;

$payRequest->requestEnvelope = new RequestEnvelope();
$payRequest->requestEnvelope->errorLanguage = "en_US";

//I set the receiver and the amounts. I also define that these are digital goods payments       
$receiver1 = new receiver();
$receiver1->email   = $opts['receiver_email'];
$receiver1->amount  = $opts['amount'];
$receiver1->paymentType = 'DIGITALGOODS';
$payRequest->receiverList = new ReceiverList();
$payRequest->receiverList = array($receiver1);

//Then I make the call
$ap          = new AdaptivePayments();
$response    = $ap->Pay($payRequest);

if(strtoupper($ap->isSuccess) == 'FAILURE') {
    log_message('error', "PAYMENT_FAIL : " . print_r($ap->getLastError(), true));
    return false;
} else {
    if($response->paymentExecStatus == "COMPLETED")  {
        header("Location: " . $this->config['success_url']);
        exit;
    } else {
        $token      = $response->payKey;
        $payPalURL  = $this->config['paypal_redirect_url'] . 'paykey='.$token;
        header("Location: ".$payPalURL);
        exit;
    }
}

这是从示例实现中获取的代码,因此不确定在这里出了什么问题。 其他可能相关的信息

  • 我正在使用自适应支付来确保发送方和接收方确实进行了交易

  • 我已将付款类型设置为“数字商品”

编辑

我随附了带有付款键的示例网址

https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=AP-0H388650F08226841

我发现了让我感到所有悲伤的问题。

贝宝SDK使用/sdk/lib/Config/paypal_sdk_clientproperties中定义的几个常量

常量包含用户名,密码,application_id,API url和其他一些常量。 这些可以直接在文件/sdk/lib/CallerServices,php 因此,与您在API中期望的相反,在设置阶段不会注入这些值,因此,如果您没有注意到该文件并更改了这些值,则上面的代码将无法工作。

要解决此问题,只需更新文件中定义的值,就可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM