我已将PayPal发票整合到我的网站中。虽然我已经创建了一个项目,共有3877个,但Paypal响应json显示了wronly。
我们已粘贴了此代码的一些部分,用于创建发票。
PHP代码
function doCreateAndSendInvoice($aryData, $aryItems)
{
$this->end_url = $this->getEndPoint("createAndSendInvoice");
$strCreateAndSendInvoice = $this->prepareCreateInvoice($aryData, $aryItems);
$response = $this->curlRequest($strCreateAndSendInvoice);
$aryRresponse = explode("&", $response);
$response = $this->parseCurlResponse($aryRresponse);
return $response;
}
$aryData['language'] = "en_US";
$aryData['merchantEmail'] = 'xxx@mail.com';//$business;
$aryData['payerEmail'] = $get_user->email;
$aryData['currencyCode'] = "USD";
$aryData['orderId'] = 123;//strtotime('now');
$aryData['invoiceDate'] = date('Y-m-d\TH:i:s\Z',strtotime($this->input->post('invoice_date')));
$aryData['dueDate'] =date('Y-m-d\TH:i:s\Z',strtotime($this->input->post('due_date')));
$aryData['paymentTerms'] = "Net45";
$aryData['merchantFirstName'] = "Pheonix ";
$aryData['merchantLastName'] = "Solutions";
$aryData['merchantBusinessName'] = "Pheonix Solutions";
$aryData['merchantWebsite'] = "https://www.website.com";
$aryData['merchantCustomValue'] = "xxxxx";
$aryData['merchantLine1'] = "xxxx";
$aryData['merchantLine2'] = "xxxx";
$aryData['merchantCity'] = "xxx";
$aryData['merchantState'] = "xxxx";
$aryData['merchantPostalCode'] = "xxx";
$aryData['merchantCountryCode'] = "xx";
$aryData['billingFirstName'] = "Billing First Name";
$aryData['billingLine1'] = 'xxxx';
// $aryData['billingLine2'] = "Billing Line 2";
$aryData['billingCity'] = 'xxxx';
$aryData['billingState'] = 'xxxx';
$aryData['billingPostalCode'] = 'xxxx';
$aryData['billingCountryCode'] = 'xxxx';
# code...
$aryItems[0]['name'] = 'title';
$aryItems[0]['quantity'] = 1;
$aryItems[0]['unitprice'] = 3877;
$res = $this->doCreateAndSendInvoice($aryData, $aryItems);
print_r($res);
输出: 上面代码的输出。
Array
(
[responseEnvelope.timestamp] => 2018-03-11T00:01:02.720-08:00
[responseEnvelope.ack] => Success
[responseEnvelope.correlationId] => xxxxxx
[responseEnvelope.build] => 31634456
[invoiceID] => xxxxx-xxxxxx
[invoiceNumber] => QUT-20180311-6
[invoiceURL] => https://www.sandbox.paypal.com/us/cgi-bin/?cmd=_inv-details&id=xxxx-xxxx-xxxxx
[payerViewURL] => https://www.sandbox.paypal.com/us/cgi_bin/webscr?cmd=_pay-inv&viewtype=altview&id=xxx-xxxx-xxxxx
[totalAmount] => 387700
)