我想将 pdf 文件附加到我使用 paypal rest api 创建的发票,但不知何故,pdf 在创建发票时消失了,没有抛出任何异常。
var uri = new Uri("http://www.pdf995.com/samples/pdf.pdf"); //edited
var converted = uri.AbsoluteUri;
var invoice = new Invoice()
{
....
attachments = new List<FileAttachment>()
{
new FileAttachment
{
name = "pdf.pdf",
url = converted
},
}
}
我还尝试使用在线提供的 pdf 文件也没有用。 发票已创建,但没有任何附件。
没有来自 Paypal 响应的任何错误,我无法找出问题所在。
注意:我使用的是沙盒(可能是这里的问题?)
该问题也出现在正式版中
最佳答案
基于 Paypal 的发票 API 的定义 file attachment ,
url 必须是 Uri
格式。
url string
The URL of the attached file, which can be downloaded.
Format: uri.
显然,位于本地驱动器中的文件是不够的。
关于c# - Paypal 休息 c# : how to Attach pdf file to invoice?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43606299/