【发布时间】:2019-07-17 18:51:33
【问题描述】:
所以,我想知道是否有任何方法可以将 PayPal invoicing API 与我的 discord.js 机器人集成。 我是 discord.js 中 API 的新手,我正在尝试解决这个问题。 一个简单的请求应该是这样的,
curl -v -X POST https://api.sandbox.paypal.com/v1/invoicing/invoices/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-d '{
"merchant_info": {
"email": "merchant@example.com",
"first_name": "David",
"last_name": "Larusso",
"business_name": "Mitchell & Murray",
"phone": {
"country_code": "001",
"national_number": "4085551234"
},
"address": {
"line1": "1234 First Street",
"city": "Anytown",
"state": "CA",
"postal_code": "98765",
"country_code": "US"
}
},
"billing_info": [
{
"email": "bill-me@example.com",
"first_name": "Stephanie",
"last_name": "Meyers"
}
],
"shipping_info": {
"first_name": "Stephanie",
"last_name": "Meyers",
"address": {
"line1": "1234 Main Street",
"city": "Anytown",
"state": "CA",
"postal_code": "98765",
"country_code": "US"
}
},
"items": [
{
"name": "Zoom System wireless headphones",
"quantity": 2,
"unit_price": {
"currency": "USD",
"value": "120"
},
"tax": {
"name": "Tax",
"percent": 8
}
},
{
"name": "Bluetooth speaker",
"quantity": 1,
"unit_price": {
"currency": "USD",
"value": "145"
},
"tax": {
"name": "Tax",
"percent": 8
}
}
],
"discount": {
"percent": 1
},
"shipping_cost": {
"amount": {
"currency": "USD",
"value": "10"
}
},
"note": "Thank you for your business.",
"terms": "No refunds after 30 days."
}'
但是我不知道如何首先请求这个。 感谢您的帮助。
【问题讨论】:
-
这只是一个 JSON POST:stackoverflow.com/questions/6158933/…
-
您已经可以在 NPM 上搜索大量 PayPal 集成库。如果没有一个可以为您提供一个简单的发票 API 接口,但我第一眼看不到它,我会感到惊讶。
-
@Rup 谢谢你,现在我在从响应中提取付款网址时遇到问题。如果我不能解决这个问题,我会发布一个单独的问题。
标签: javascript node.js paypal discord discord.js