2012-07-31 49 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所期望的相反,在设置阶段不会注入这些值,所以如果您没有注意到该文件并更改了这些值,则上述代码将不起作用。

要解决这个问题,只需更新文件中定义的值,您应该很好。