unlock-protocol / unlock

Ʉnlock is a protocol for memberships built on a blockchain.
https://unlock-protocol.com
MIT License
844 stars 251 forks source link

Add a webhook to checkout #15067

Open julien51 opened 1 week ago

julien51 commented 1 week ago

Our checkout UI includes several configuration options. We need to add a new configuration option called hooks at the "root" of the config. This object should include multiple properties, whose key should be the events triggered by the Paywall library:

{
   status: "",
   authenticated: "",
   transactionSent: "", 
   metadata: ""
}

Each of the value is a URL.

Then, in the checkout UI we should implement the triggers. They should be triggered at the same time as the Javascript events, as POST requests. The body of the POST request should be a json object matching the payload sent by the events. Any 2XX response should be considered a success. Any other should be considered an error and the paywall should do up to 2 retries (maximum of 3 notifications), after 1 and 3 seconds respectively.