Paypal REST API - 缺少描述/项目名称

时间:2016-07-21 15:59:11

标签: ruby api rest paypal credit-card

我正在使用paypal ruby​​ sdk以通过rest api处理信用卡。从信用卡处理的角度来看,一切都很好。信用卡处理得恰到好处,没有任何问题。

不幸的是,当我在沙盒(或实时)商家paypal帐户上预先形成交易的csv时,"项目标题"字段未填充,我也看不到任何地方都使用了描述字段。

请求paypal:

Request[post]: https://api.sandbox.paypal.com/v1/payments/payment
Request.body={
    "intent":"sale",
    "payer":{
        "payment_method":"credit_card",
        "funding_instruments":[{
            "credit_card":{
                "number":"xxxxxxxxxxxxxxxx",
                "type":"visa",
                "expire_month":10,
                "expire_year":2020,
                "first_name":"First Name",
                "last_name":"Last Name"
            }
        }]
    },
    "transactions":[{
        "amount":{
            "currency":"USD",
            "total":"1"
        },
        "description":"This is item description",
        "item_list":{
            "items":[{
                "quantity":"1",
                "name":"This is item description",
                "price":"1",
                "currency":"USD",
                "sku":"This is item description"
            }]
        }
    }]
}

在成功的paypal响应中,我收到所有这些数据,包括填充了&#34的字段;这是项目描述"。

我的问题是,为了填充"项目标题"我们需要为此api调用提供哪个参数。交易中的字段csv export?

"描述"的目的是什么?这个api请求中的字段以及在我们使用信用卡处理付款之后在paypal端(显示)使用此字段的位置?

EDITED

也尝试使用PHP SDK(只是为了确保这不是特定SDK的问题)。最后似乎问题是" 是否有一个字段用作REST API的一部分,它对应于'项目标题' paypal导出中的列?"

2 个答案:

答案 0 :(得分:5)

确实从pp_pduan回答了最初的赏金问题(与具体报告有关)。我正在添加与此特定报告和其他报告相关的更新。

对于信用卡处理,您可以在paypal端使用以下API:

  1. Rest API
  2. DoDirect Payment Api(Pro 3.0)
  3. Payflow Gateway Api(Pro 1.5-2.0)
  4. 根据我与paypal方面的讨论以及相当详细的研究,不可能使用REST API为某些报告填充项目名称。 对于信用卡处理(为了避免报告系统的一般问题),如果您有专业账户,我建议使用DoDirect Payment Api。似乎这个特定的API已经过时了#34;然后REST API信用卡处理因此它更稳定,并且报告系统没有任何问题。

    考虑到DoDirect Payment Api有奇怪的文档(至少对我来说这没有得到适当的介绍)我建议使用工作解决方案(示例)检查以下php repository

答案 1 :(得分:2)

尝试像这样放置一个样本请求有效负载,

{
  "intent": "sale",
  "payer": {
    "payment_method": "paypal"
  },
  "redirect_urls": {
    "return_url": "http://localhost:80/getpaypal",
    "cancel_url": "http://localhost:80/cancel"
  },
  "transactions": [
    {
     "description": "Transaction Desc Text",
      "amount": {  
            "total":"80",
            "currency":"USD"
      },
      "item_list": {
        "items": [
          {
            "name": "Test Ticket 1",
            "currency": "USD",
            "quantity": "1",
            "sku": "55a460ff65f13",
            "price": "10"
          },
          {
            "name": "Test Ticket 2",
            "currency": "USD",
            "quantity": "2",
            "sku": "55a460ff66c7a",
            "price": "20"
          },
          {
            "name": "Test Ticket 3",
            "currency": "USD",
            "quantity": "3",
            "sku": "55a460ff66ce2",
            "price": "10"
          }
        ]
      },
      "invoice_number": "55a460ff696br"
    }
  ]
}

当您从PayPal个人资料中下载交易历史记录(csv)时,

  • 如果您勾选了“包含购物车详情”选项, enter image description here

    每个name对象下的“item”字段将显示在“项目标题”列中;并且description对象中的transaction字段也将位于该列中

enter image description here

  • 如果您选择“包含购物车详细信息”选项,则交易将是csv中没有购物车项目行的单条记录,您只会看到“"description": "Transaction Desc Text",”({{1} 项目标题 col
  • 中的description对象中的}字段