Paypal自适应链支付产品名称问题

时间:2018-03-27 13:39:51

标签: php paypal payment

我已在付款选项中使用“创建”方法创建了付款密钥。

创建了SetPaymentOptions。显示选项中的商家名称工作正常,但产品详细信息未反映在付款页面上。我浪费了一天来解决此产品名称问题。

        $actionType = "CREATE";
        $currencyCode = "USD";
        $seller_paypal_id = $this->config->item('paypalMerchantEmail');
        if ($item_number !='') {
             $receiverEmail = array($seller_paypal_id);
             $receiverAmount = array($item_amount); 
             $primaryReceiver = array("false");
        }
        if (isset($receiverEmail)) {
            $receiver = array();
        for ($i = 0; $i < count($receiverEmail); $i++) {
        $receiver[$i] = new Receiver();
        $receiver[$i]->email = $receiverEmail[$i];
        $receiver[$i]->amount = $receiverAmount[$i];
        $receiver[$i]->primary = $primaryReceiver[$i];

        }
        $receiverList = new ReceiverList($receiver);

        }
        $payRequest = new PayRequest(new RequestEnvelope("en_US"), $actionType, $cancelUrl, $currencyCode, $receiverList, $returnUrl);
        $service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());

        try {
        $response = $service->Pay($payRequest);
        $ack = strtoupper($response->responseEnvelope->ack);
        $payKey = $response->payKey;
        $setPaymentOptionsRequest = new SetPaymentOptionsRequest(new RequestEnvelope("en_US"));
        $setPaymentOptionsRequest->payKey = $payKey;
        $receiverOptions = new ReceiverOptions();
        $setPaymentOptionsRequest->receiverOptions[] = $receiverOptions;
        $receiverOptions->description = "Listing fees for featured ";
        $receiverOptions->itemname = "Feature Listing Fee";
        $receiverOptions->itemid = $item_number;
        $receiverOptions->customId = $device_imei;
        $receiverOptions->referrerCode = $device_imei;

        $receiverId = new ReceiverIdentifier(); 
        $receiverId->email = $seller_paypal_id;
        $receiverOptions->receiver = $receiverId;

        $invoiceItems = array();
        $item = new InvoiceItem();
        $item->name = "Feature Listing Fee"; 
        $item->identifier = 1;
        $item->price = $item_amount;
        $item->itemPrice = $item_amount;
        $item->itemCount = 1;
        $invoiceItems[] = $item;

        $receiverOptions->invoiceData = new InvoiceData();
        $receiverOptions->invoiceData->item = $invoiceItems;

        $setPaymentOptionsRequest->displayOptions = new DisplayOptions();
        $setPaymentOptionsRequest->displayOptions->businessName = "Business Marketplace";
        $responses=$service->SetPaymentOptions($setPaymentOptionsRequest);
        $acks = strtoupper($responses->responseEnvelope->ack);
        if ($acks == "SUCCESS") {
          $this->session->set_userdata('pay_key', $payKey);
          $this->session->set_userdata('item_number', $item_number);
          $this->session->set_userdata('item_name', $item_name);
          $this->session->set_userdata('device_imei', $device_imei);
          $payPalURL = PAYPAL_REDIRECT_URL . '_ap-payment&paykey=' . $payKey;
          header('Location:' . $payPalURL);

不知道为什么receiverOptions无效。

1 个答案:

答案 0 :(得分:0)

PayPal停止了对新商家的自适应支付支持。 PayPal将推出一款新产品&#34; PayPal for marketplace&#34;不久。敬请期待。