Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom data from paypal JS button into webhook

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?
like image 302
puntofisso Avatar asked Jan 27 '16 13:01

puntofisso


1 Answers

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

like image 106
VJ-PP Avatar answered Oct 21 '22 11:10

VJ-PP