我正在使用PayPal SDK for .Net与Adaptive Payments合作。 我正在尝试使用SetPaymentOptions方法设置我希望在“付款摘要”部分中显示的项目,但是,当我使用从Pay方法收到的付款密钥将网站重定向到沙箱批准页面时,付款摘要仅显示一行说“faciliator帐户的测试商店”和总金额。
响应返回成功代码,另外我看到其他参数,例如BuisnessName(在DisplayOptions中)显示在页面上。
以下是我正在尝试执行的代码(参数被替换为映射到实际帐户,网址,金额等的实际值)。 谁能告诉我我做错了什么?
谢谢!
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);
// ....
}
答案 0 :(得分: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与接收者的通信中。