【发布时间】:2019-12-21 15:32:00
【问题描述】:
我想知道如何从 PayPal API v2 获取交易 ID。
我已经通过 PayPal API v2 (https://developer.paypal.com/docs/api/orders/v2/) 创建了一个订单并成功捕获它。订单的状态为 COMPLETED,订单已按预期出现在我的 PayPal 沙盒账户的活动中。现在我想获取捕获交易的交易 ID(见图),但我无法获得它。
我通过 PayPal API 获取订单的详细信息,但只有检索到的订单 ID 和捕获 ID。 API 响应中缺少图像上标记的交易 ID。我必须做什么才能获得交易 ID?非常感谢。
{
"statusCode": 200,
"result": {
***************************************************************
"id": "91K02466UY433503E", <= ORDER ID
***************************************************************
"intent": "CAPTURE",
"purchase_units": [
{
"reference_id": "PZ755454789",
"amount": {
"currency_code": "EUR",
"value": "48.10",
"breakdown": {
"item_total": {
"currency_code": "EUR",
"value": "32.06"
},
"shipping": {
"currency_code": "EUR",
"value": "9.95"
},
"handling": {
"currency_code": "EUR",
"value": "0.00"
},
"tax_total": {
"currency_code": "EUR",
"value": "6.09"
},
"insurance": {
"currency_code": "EUR",
"value": "0.00"
},
"shipping_discount": {
"currency_code": "EUR",
"value": "0.00"
},
"discount": {
"currency_code": "EUR",
"value": "0.00"
}
}
},
"payee": {
"email_address": "XXXXXXXXXXXXXXX",
"merchant_id": "HE3H3VSFV3Q5G"
},
"description": "PZ755454789",
"custom_id": "PZ755454789",
"items": [
{
"name": "Calvin Klein Euphoria for Women Eau De Parfum 100 ml (woman)",
"unit_amount": {
"currency_code": "EUR",
"value": "32.06"
},
"tax": {
"currency_code": "EUR",
"value": "6.09"
},
"quantity": "1",
"sku": "24837"
}
],
"shipping": {
"name": {
"full_name": "XXXXXXXXX"
},
"address": {
"address_line_1": "XXXXXXX",
"admin_area_2": "XXXXX",
"postal_code": "XXXXX",
"country_code": "XX"
}
},
"payments": {
"captures": [
{
*******************************************************
"id": "40J088343X584271G", <= CAPTURE ID
*******************************************************
"status": "COMPLETED",
"amount": {
"currency_code": "EUR",
"value": "48.10"
},
"final_capture": true,
"seller_protection": {
"status": "ELIGIBLE",
"dispute_categories": [
"ITEM_NOT_RECEIVED",
"UNAUTHORIZED_TRANSACTION"
]
},
"seller_receivable_breakdown": {
"gross_amount": {
"currency_code": "EUR",
"value": "48.10"
},
"paypal_fee": {
"currency_code": "EUR",
"value": "1.26"
},
"net_amount": {
"currency_code": "EUR",
"value": "46.84"
}
},
"custom_id": "PZ755454789",
"links": [
{
"href": "https:\/\/api.sandbox.paypal.com\/v2\/payments\/captures\/40J088343X584271G",
"rel": "self",
"method": "GET"
},
{
"href": "https:\/\/api.sandbox.paypal.com\/v2\/payments\/captures\/40J088343X584271G\/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders\/91K02466UY433503E",
"rel": "up",
"method": "GET"
}
],
"create_time": "2019-08-14T12:44:13Z",
"update_time": "2019-08-14T12:44:13Z"
}
]
}
}
],
"payer": {
"name": {
"given_name": "XXXXXX",
"surname": "XXXXXXX"
},
"email_address": "XXXXXXXXXXXX",
"payer_id": "SS5Q2CS6CKX5L",
"phone": {
"phone_number": {
"national_number": "0111111111"
}
},
"address": {
"country_code": "XX"
}
},
"update_time": "2019-08-14T12:44:13Z",
"links": [
{
"href": "https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders\/91K02466UY433503E",
"rel": "self",
"method": "GET"
}
],
"status": "COMPLETED"
},
"headers": {
"": "",
"Date": "Fri, 16 Aug 2019 06",
"Server": "Apache",
"paypal-debug-id": "557573ed4e5b2",
"HTTP_X_PP_AZ_LOCATOR": "sandbox.slc",
"Paypal-Debug-Id": "557573ed4e5b2",
"Set-Cookie": "X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00",
"Vary": "Authorization",
"Content-Length": "2339",
"Connection": "close",
"Content-Type": "application\/json"
}
}
【问题讨论】:
-
您能否附上一份带有订单 ID 和捕获 ID 的响应示例?
-
包含响应(订单 ID 和捕获 ID 用 **** 标记)
标签: paypal