我正在使用适用于 .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);
// ....
}