6

The JavaScript PayPal button, http://paypal.github.io/JavaScriptButtons/ allows custom data to be sent in the data-custom field.

When using IPN, these data are clearly visible and usable.

However, I don't find any mention of custom data in the webhook documentation; I would expect the "Sale Completed" event to receive something about custom data.

So my question is twofold:

  1. Has anyone managed to get the data and knows what field contains them?
  2. Is there a way to simulate this, given the webhook simulator does not allow any field to be entered?
puntofisso
  • 383
  • 1
  • 3
  • 17

1 Answers1

1

Webhooks do not support any custom data for simulator. Simulator provides a sample of payload for an event. It does not allow any other data field except URL/EventType. If you want to use the custom data you may use them and don't want to use a live account for testing, you can try it with a sandbox account and go through flow for the Webhook event type for which you want to send custom data.

Also sample for PAYMENT.SALE.COMPLETED for your reference:

{
  "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"
    }
  ]
}

Has anyone managed to get the data and knows what field contains them? Not Supported. You may refer for the fields at https://github.com/paypal/JavaScriptButtons#editable-inputs

Is there a way to simulate this, given the webhook simulator does not allow any field to be entered? Not Supported

VJ-PP
  • 151
  • 8
  • It's still not clear to me, though, where the custom data could be found in there? – puntofisso Feb 09 '16 at 15:24
  • Webhooks Simulator does not support custom data. Simulator just uses an event name as an input and maps it with corresponding "Sample Payload" and returns. – VJ-PP Feb 09 '16 at 19:00
  • 1
    1/2: Never mind the simulator, I think he's asking if the paypal smart buttons support the sending of custom data, such that this custom data comes across in the webhook. For example, if you wanted to know which user completed a subscription at the time the webhook comes in, the issue is that the webhook doesn't tell me the userid of the user that completed the subscription and I dont have access to the users cookie on the webhook.... – John May 28 '20 at 08:18
  • 1
    ...I can get the info on the frontend upon completing smart button subscription but not secure. That webhook though - the thing that proves the subscription was real - you have no way to associate it to your user. Do you? One might hope that you could supply a custom data field at the smart button that would also come in / be available in the webhook. Is there another way to achieve this goal? – John May 28 '20 at 08:20
  • https://github.com/paypal/JavaScriptButtons#editable-inputs is dead – Omar Salem Aug 02 '21 at 23:38
  • I feel like I am missing something essential here... How can this not be presented as the main flow? – Brainmaniac Dec 03 '21 at 20:41