我想检索有关在PayPal交易中售出的每个项目的信息。它们在销售点加载到事务对象$transaction->setItemList($itemList);
中,但没有存储在本地数据库中。
我只能访问销售和支付ID。使用PayPal接口,如何取回商品列表?
也许我没有仔细阅读API文档,但我似乎找不到任何关于这方面的信息。
发布于 2015-08-25 22:43:44
是的,您可以通过Look调用使用付款ID来检索商品列表详细信息(假设您传递给了PayPal)。您可以查看下面的API调用链接:
https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource
我已经在沙盒账户中包含了对我的一个支付ID的调用:
GET https://api.sandbox.paypal.com/v1/payments/payment/PAY-9NS54822BJ985714GKQ5RH2Y
{
"id": "PAY-9NS54822BJ985714GKQ5RH2Y",
"create_time": "2014-10-12T23:51:07Z",
"update_time": "2014-10-12T23:57:54Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"status": "VERIFIED",
"payer_info": {
"email": "XXXXXXX",
"first_name": "XXXX Personal Test",
"last_name": "Account",
"payer_id": "XXXXX",
"shipping_address": {
"line1": "cxas",
"line2": "asa",
"city": "FL",
"state": "FL",
"postal_code": "95616",
"country_code": "US",
"recipient_name": "XXXXXPersonal Test Account"
},
"phone": "408-767-7151"
}
},
"transactions": [
{
"amount": {
"total": "20.00",
"currency": "USD",
"details": {
"subtotal": "18.00",
"tax": "1.00",
"shipping": "1.00"
}
},
"description": "This is payment description.",
"item_list": {
"items": [
{
"name": "Hat",
"sku": "product12345",
"price": "2.00",
"currency": "USD",
"quantity": "3",
"description": "This is desc"
},
{
"name": "Hat",
"sku": "product12345",
"price": "2.00",
"currency": "USD",
"quantity": "3",
"description": "This is desc"
},
{
"name": "Hat",
"sku": "product12345",
"price": "2.00",
"currency": "USD",
"quantity": "3",
"description": "This is desc"
}
]
},
"related_resources": [
{
"sale": {
"id": "0P200860V96590012",
"create_time": "2014-10-12T23:51:07Z",
"update_time": "2014-10-12T23:57:54Z",
"amount": {
"total": "20.00",
"currency": "USD"
},
"payment_mode": "INSTANT_TRANSFER",
"state": "completed",
"protection_eligibility": "ELIGIBLE",
"protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
"parent_payment": "PAY-9NS54822BJ985714GKQ5RH2Y",
"transaction_fee": {
"value": "0.88",
"currency": "USD"
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/0P200860V96590012",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/0P200860V96590012/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-9NS54822BJ985714GKQ5RH2Y",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-9NS54822BJ985714GKQ5RH2Y",
"rel": "self",
"method": "GET"
}
]
}
https://stackoverflow.com/questions/32192277
复制相似问题