簡體   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