2012-07-31 79 views
8

我正在嘗試使用貝寶的自適應付款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. 
  • 在生產模式中,應用程序獲取paykey
  • 追加到貝寶URL,然後將其重定向到他們的網站
  • 在站點的負載,我得到以下信息

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

它結束了最後的URL - https://ic.paypal.com/webapps/adaptivepayment/flow/payinit?execution=e6s1

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

還有一個「返回」按鈕,在那裏,當我點擊它,我一次比一次採取不同的網站(貌似我送送

已經包含了我使用下面

$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; 
    } 
} 

這是代碼其樣本方面採取的代碼隨機failUrls),所以不是很確定這裏出了什麼問題。這可能是相關的其他信息

  • 我使用自適應付款,以確保發送者和接收者 實際上做交易

  • 我已經設置了付款方式爲「數字商品」

編輯

我已經包含噸樣品網址他支付的鑰匙

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

你可以包含$ payPalURL的回聲嗎? – Robert 2012-07-31 12:44:16

+2

@羅伯特當然,我已經用這個信息更新了問題。 – JohnP 2012-07-31 13:26:31

回答

4

我發現這個問題給了我所有的這種悲傷。

貝寶SDK將使用一對夫婦,其在/sdk/lib/Config/paypal_sdk_clientproperties

常量包含用戶名,密碼定義的常量,APPLICATION_ID的API URL和其他幾個人。這些直接用於文件/sdk/lib/CallerServices,php。因此,與API所期望的相反,在設置階段不會注入這些值,所以如果您沒有注意到該文件並更改了這些值,則上述代碼將不起作用。

要解決這個問題,只需更新文件中定義的值,您應該很好。