我有這個問題。我遵循本教程 - >http://www.youtube.com/watch?v=rzRR1i-F_VA貝寶自適應付款php
並且在設置完所有內容後,我在通過驗證過程中遇到了一些問題。經過一些關於認證的研究,我已經測試過了 - >https://developer.paypal.com/webapps/developer/docs/classic/lifecycle/ug_sandbox/
在這個過程的某個階段(做測試請求),我在bash控制檯中測試了它,並且我的用戶標識,密碼和簽名工作。所以我認爲問題出在我正在使用的代碼中。
所以這裏的代碼:
<?php
class PaypalTest extends CComponent{
public $api_user = "**********************";
public $api_pass = "***********";
public $api_sig = "**************************";
public $app_id = "APP-80W284485P519543T";
public $apiUrl = 'https://svcs.sandbox.paypal.com/AdaptivePayments/';
public $paypalUrl="https://www.paypal.com/webscr?cmd=_ap-payment&paykey=";
public $headers;
public function __construct(){
$this->headers = array(
"X-PAYPAL-SECURITY-USERID: ".$this->api_user,
"X-PAYPAL-SECURITY-PASSWORD: ".$this->api_pass,
"X-PAYPAL-SECURITY-SIGNATURE: ".$this->api_sig,
"X-PAYPAL-REQUEST-DATA-FORMAT: JSON",
"X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
"X-PAYPAL-APPLICATION-ID: ".$this->app_id,
);
}
public function getPaymentOptions($paykey){
}
public function setPaymentOptions(){
}
public function _paypalSend($data,$call){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->apiUrl.$call);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HEADER, $this->headers);
$response = json_decode(curl_exec($ch),true);
return $response;
}
public function splitPay(){
// create the pay request
$createPacket = array(
"actionType" =>"PAY",
"currencyCode" => "USD",
"receiverList" => array(
"receiver" => array(
array(
"amount"=> "1.00",
"email"=>"********@hotmail.com"
),
array(
"amount"=> "2.00",
"email"=>"********@gmail.ca"
),
),
),
"returnUrl" => "http://test.local/payments/confirm",
"cancelUrl" => "http://test.local/payments/cancel",
"requestEnvelope" => array(
"errorLanguage" => "en_US",
"detailLevel" => "ReturnAll",
),
);
$response = $this->_paypalSend($createPacket,"Pay");
}
}
而這裏的電話:
$payment = new PaypalTest();
$payment->splitPay();
很簡單,但有什麼不工作。而且我不是很熟悉,捲曲,所以我想你們可以幫我
PS:我在沙盒模式
感謝
卡爾
什麼不起作用?你會得到什麼錯誤? –
http://stackoverflow.com/questions/19645381/paypal-adaptive-payment-php 任何人都可以幫我完成付款步驟 – xyz