我正在开发一个应用程序,与PayPal的API通信,以创建发票。
这是我的请求机构:
{
"detail": {
"currency_code": "USD",
"note": "Thank you for using my services!"
},
"invoicer": {
"name": {
"given_name": "Shreyas",
"surname": "Ayyengar"
},
"email_address": "{email}",
"website": "{website}"
},
"primary_recipients": [
{
"billing_info": {
"email_address": "{client_email}"
}
}
],
"items": [
{
"name": "{invoice_name}",
"description": "{invoice_description}",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "{invoice_amount}"
},
"tax": {
"name": "PayPal Service Tax",
"percent": "7.25"
}
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": false
},
"allow_tip": true
}
}虽然有像:{client_email}这样的占位符,但我可以保证它们正在按预期正确地替换。
然而,我被抛出了一个我无法理解的VALIDATION_ERROR:{"name":"VALIDATION_ERROR","message":"Invalid request - see details.","information_link":"https://developer.paypal.com/docs/api/invoicing/#errors","details":[{"field":"merchant_info","issue":"cannot be null."},{"field":"items[0].unit_price","issue":"null"}]}
据我所能理解的,这个错误说我丢失了像Items[].unit_price和merchant_info这样的信息,但是我不知道它应该在我的请求体中的位置。我正在跟踪直接文档这里,但我看不到提到unit_price或merchant_info的任何内容。
发布于 2022-05-28 14:49:38
将请求提交到正确的API端点https://api-m.sandbox.paypal.com/v2/invoicing/invoices
注意主版本号。有关细节,请参阅发票API参考。
https://stackoverflow.com/questions/72416591
复制相似问题