PayPal自适应支付API添加商品详情+运费

时间:2015-10-19 08:06:29

标签: php paypal

我正在使用paypal自适应支付API。 当用户在我的网站上提交购买按钮时,他会重定向到paypal页面, 在paypal页面中,他只看到商品的成本金额和卖家商店名称。没有发货细节,没有项目细节。只是卖家名称+金额。 我错过了什么? 如何将运费和项目详细信息添加到paypal页面。

这是我到目前为止所做的:

$receiver[0] = new Receiver();
$receiver[0]->amount = $total_amount;
$receiver[0]->email =  $seller_email;


$itemData[0] = new InvoiceItem();
$itemData[0]->name = "test_item";
$itemData[0]->identifier = "123";
$itemData[0]->price = "10.00";
$itemData[0]->itemCount = "1";
$itemData[0]->itemPrice = "10.00";

$invoiceData->totalTax = "0";
$invoiceData->totalShipping = "10";
$invoiceData->item = $itemData;

$senderOptions = new SenderOptions();
$senderOptions->addressOverride = "1";
$senderOptions->requireShippingAddressSelection = "1";

$receiverOptions = new ReceiverOptions();
$receiverOptions->customId = "customID";
$receiverOptions->receiver = $receiverInvoice;
$receiverOptions->invoiceData = $invoiceData;
$receiverOptions->SenderOptions = $senderOptions;


$receiverList = new ReceiverList($receiver);


$requestEnvelope = new RequestEnvelope("en_US");

$payRequest = new PayRequest();
$payRequest->requestEnvelope = $requestEnvelope; 
$payRequest->receiverOptions = $receiverOptions;
$payRequest->receiverList = $receiverList;
$payRequest->actionType = "PAY";
$payRequest->cancelUrl = "http://pay.php?success=cancel";
$payRequest->returnUrl = "http://pay.php?success=true";
$payRequest->currencyCode = "USD";
$payRequest->ipnNotificationUrl = "http://replaceIpnUrl.com";



$adaptivePaymentsService = new AdaptivePaymentsService($sdkConfig);

$payResponse = $adaptivePaymentsService->Pay($payRequest);

$ack = strtoupper($payResponse->responseEnvelope->ack);

     if ($ack == "SUCCESS") {

       $payKey = $payResponse->payKey;
        $payPalURL = PAYPAL_REDIRECT_URL. $payKey;

    } else {
    die();
    }

    header('Location:' . $payPalURL);

0 个答案:

没有答案