doujia4759 2015-08-24 21:46
浏览 58

有没有办法从PayPal销售ID中取回ItemList?

I would like to retrieve information about each item sold in a PayPal transaction. They were loaded into a Transaction object at the point of sale: $transaction->setItemList($itemList);, but were not stored on a local database.

I only have access to sale and payment ID's. Using the PayPal API, how can I get the list of items back?

Maybe I'm not looking at the API docs hard enough, but I can't seem to find any info about this.

  • 写回答

1条回答 默认 最新

  • dongzhan1570 2015-08-25 14:43
    关注

    Yes you can retrieve the item list details(assuming that you passed to the PayPal) using the Payment ID's via the Look Up API call . You can check the below link for the API call:

    https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource

    I have included the call to one of my Payment ID in sandbox account :

    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"
    }
    ]
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看