我使用.NET的paypal API,并通过方法创建付款:POST/v1/payments/payment。PayPal:从支付中退款
我的付款创建要求:
Payment = {
intent: 'sale',
payer = {
payment_method = 'paypal'
},
transactions = [
transaction= = {
amount = {
currency = 'GBP',
total = '10.00'
},
item_list = {
items = [
item = {
quantity = '1',
name = 'name',
price = '10.00',
currency = 'GBP',
sku = 'description'
}
],
shipping_address = {
recipient_name = 'name',
line1 = 'address',
city = 'city',
country_code = 'GB',
postal_code = 'G69 7LS'
}
}
}
],
redirect_urls = {
return_url = 'http://localhost/',
cancel_url = 'http://localhost/'
}
}
正如你所看到的,我的“M没有创造类型的关联交易‘买卖’
创建并执行付款后,一些。我们需要退还客户的资金,但为了退款,我们需要一个saleId。我试图通过付款创建生成一个saleId,但它仍然失败,因为销售对象似乎被API忽略。
不能流利地使用API(所以如果我错过了一个细节,请谅解),但根据[文档](https://developer.paypal.com/docs/api/#execute-an-approved-paypal-支付),你应该收到一个'[response] .transactions.related_resources.sale.id',它将被传回[退款](https://developer.paypal.com/docs/api/#refund-a-sale )。当你说忽略时,响应中是否缺少'[response] .transactions.related_resources.sale'? –
支付是作为答案给出的,它带有一个空数组payment_resources。 –