2

我正在使用适用于 .Net 的 PayPal SDK 处理自适应支付。我正在尝试使用 SetPaymentOptions 方法来设置我希望在“付款摘要”部分中显示的项目,但是,当我使用从“付款”方法收到的付款密钥将网站重定向到沙盒批准页面时,付款摘要仅显示一行写着“促进者帐户的测试商店”和总金额。

响应返回一个成功代码,而且我看到页面上显示了其他参数,例如 BuisnessName(在 DisplayOptions 中)。

以下是我尝试执行的代码(参数被映射到实际帐户、url、金额等的实际值替换)。谁能告诉我我做错了什么?

谢谢!

        AdaptivePaymentsService service = new AdaptivePaymentsService();
        RequestEnvelope envelopeRequest = new RequestEnvelope();
        envelopeRequest.errorLanguage = "en_US";

        List<Receiver> listReceiver = new List<Receiver>();
        Receiver receive = new Receiver((decimal)300.15);
        receive.email = "receiver@mail.com";
        listReceiver.Add(receive);
        ReceiverList listOfReceivers = new ReceiverList(listReceiver);

        PayRequest reqPay = new PayRequest(envelopeRequest, "CREATE", "url",
            "USD", listOfReceivers, "url");
        reqPay.sender = new SenderIdentifier();
        reqPay.sender.email = "sender@mail.com";

        PayResponse responsePay = service.Pay(reqPay);

        if (responsePay != null && responsePay.responseEnvelope.ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
        {
            SetPaymentOptionsRequest payOptionsReq = new SetPaymentOptionsRequest();
            payOptionsReq.displayOptions = new DisplayOptions()
            {
                businessName = "My business name"
            };
            payOptionsReq.payKey = responsePay.payKey;
            payOptionsReq.requestEnvelope = envelopeRequest;
            payOptionsReq.receiverOptions = new List<ReceiverOptions>()
                {
                    new ReceiverOptions()
                    {
                        receiver = new ReceiverIdentifier()
                        {
                            email = "receiver@mail.com"
                        },
                        description = "invoice test",
                        invoiceData = new InvoiceData()
                        {
                            item = new List<InvoiceItem>()
                            {
                                new InvoiceItem()
                                {
                                    identifier = "1",
                                    itemCount = 2,
                                    itemPrice = (decimal)100.0,
                                    name = "test",
                                    price = (decimal)150.0
                                },
                                new InvoiceItem()
                                {
                                    identifier = "2",
                                    itemCount = 1,
                                    itemPrice = (decimal)100.0,
                                    name = "test2",
                                    price = (decimal)150.15
                                }
                            },
                            totalShipping = 0,
                            totalTax = 0
                        }
                    }
                };

            SetPaymentOptionsResponse r = service.SetPaymentOptions(payOptionsReq);

            // ....
        }
4

1 回答 1

2

我正在使用带有嵌入式结帐的自适应链式支付。

使用自适应支付时,您​​无法自定义已完成的支付页面。

在这个话题上,我花了很多时间和 PayPal 通电话。您在付款选项中设置的 SenderOptions、ReceiverOptions 和 InvoiceData 信息仅在即时付款通知中可用。好消息是 IPN 很容易实现。

http://www.codeproject.com/Tips/84538/Setting-up-PayPal-Instant-Payment-Notification-IPN

您可以解析 IPN 信息并向您的买家和卖家发送电子邮件。

如果您希望PayPal 的电子邮件包含任何其他信息,则仅限于 PaymentRequest 的备注字段。在您的示例中:

reqPay.sender = new SenderIdentifier();
reqPay.sender.email = "sender@mail.com";
string memo = "Item: " + item_name + " " + item_price + SOME_NONSENSE_DELIMITER;
requestPay.memo = memo;
PayResponse responsePay = service.Pay(reqPay);

需要 SOME_NONSENSE_DELIMITER 作为行尾,因为不幸的是,换行和 html 被忽略了,但至少在 PayPal 与接收者的通信中显示了一些内容。

于 2013-12-04T20:34:26.620 回答