从paypal JS按钮到webhook

时间:2016-01-27 13:03:01

标签: paypal paypal-ipn paypal-webhooks

JavaScript PayPal按钮http://paypal.github.io/JavaScriptButtons/允许在数据自定义字段中发送自定义数据。

使用IPN时,这些数据清晰可见且可用。

但是,我在webhook文档中找不到任何自定义数据;我希望"销售完成"有关自定义数据的事件。

所以我的问题有两个:

  1. 有没有人设法获取数据并知道哪个字段包含它们?
  2. 有没有办法模拟这个,因为webhook模拟器不允许输入任何字段?

1 个答案:

答案 0 :(得分:1)

Webhooks不支持任何模拟器的自定义数据。模拟器提供事件的有效负载样本。它不允许除URL / EventType之外的任何其他数据字段。如果您想使用自定义数据,并且不想使用实时帐户进行测试,可以使用沙盒帐户进行尝试,并查看要为其发送自定义数据的Webhook事件类型的流程。

另请参阅PAYMENT.SALE.COMPLETED以供参考:

{
  "id": "WH-2WR32451HC0233532-67976317FL4543714",
  "create_time": "2014-10-23T17:23:52Z",
  "resource_type": "sale",
  "event_type": "PAYMENT.SALE.COMPLETED",
  "summary": "A successful sale payment was made for $ 0.48 USD",
  "resource": {
    "id": "80021663DE681814L",
    "create_time": "2014-10-23T17:22:56Z",
    "update_time": "2014-10-23T17:23:04Z",
    "amount": {
      "total": "0.48",
      "currency": "USD"
    },
    "payment_mode": "ECHECK",
    "state": "completed",
    "protection_eligibility": "ELIGIBLE",
    "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
    "clearing_time": "2014-10-30T07:00:00Z",
    "parent_payment": "PAY-1PA12106FU478450MKRETS4A",
    "links": [
      {
        "href": "https://api.paypal.com/v1/payments/sale/80021663DE681814L",
        "rel": "self",
        "method": "GET"
      },
      {
        "href": "https://api.paypal.com/v1/payments/sale/80021663DE681814L/refund",
        "rel": "refund",
        "method": "POST"
      },
      {
        "href": "https://api.paypal.com/v1/payments/payment/PAY-1PA12106FU478450MKRETS4A",
        "rel": "parent_payment",
        "method": "GET"
      }
    ]
  },
  "links": [
    {
      "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-2WR32451HC0233532-67976317FL4543714",
      "rel": "self",
      "method": "GET"
    },
    {
      "href": "https://api.paypal.com/v1/notifications/webhooks-events/WH-2WR32451HC0233532-67976317FL4543714/resend",
      "rel": "resend",
      "method": "POST"
    }
  ]
}

有没有人设法获取数据并知道哪些字段包含它们? 不支持。 您可以参考https://github.com/paypal/JavaScriptButtons#editable-inputs

中的字段

有没有办法模拟这个,因为webhook模拟器不允许输入任何字段? 不支持