new WebhookService()
Creates a new WebhookService. Generally you should never create a PAYMILL service on your own. Instead use the exported "webhooks".
- Source:
Methods
-
createEmail(email, event_types, cb) → {Promise}
-
Instead of setting the url parameter you can set the email parameter to create a webhook, where we send mails to in case of an event.
Parameters:
Name Type Argument Description emailstring the webhooks email. must be a valid mail address. event_typesArray.<string> includes a set of webhook event types as strings. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Webhook or rejected with a PMError.- Type
- Promise
-
createUrl(url, event_types, cb) → {Promise}
-
With this call you can create a webhook to a url via the API.
Parameters:
Name Type Argument Description urlstring the url of the webhook event_typesArray.<string> includes a set of webhook event types as strings. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Webhook or rejected with a PMError.- Type
- Promise
-
detail(obj, cb) → {Promise}
-
Get a Webhook.
Parameters:
Name Type Argument Description objstring | Webhook a Webhook object or its id. note, if you set a Webhook object it will be updated, no new object will be created. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Webhook or rejected with a PMError.- Type
- Promise
-
list(count, offset, filter, order, cb) → {Promise}
-
List Webhooks.
Parameters:
Name Type Argument Description countstring | number <optional>
limit of objects to be listed. use for pagination. offsetstring | number <optional>
offset. use for pagination. filterWebhook.Filter | null <optional>
a list filter or null. orderWebhook.Order | null <optional>
a list order or null. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a PayMillObjectList or rejected with a PMError.- Type
- Promise
-
remove(obj, cb) → {Promise}
-
Remove a Webhook. f you set the attribute cancel_at_period_end parameter to the value true, the subscription will remain active until the end of the period. The subscription will not be renewed again. If the value is set to false it is directly terminated but pending transactions will still be charged.
Parameters:
Name Type Argument Description objWebhook a Webhook object or its id. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Webhook or rejected with a PMError.- Type
- Promise
-
update(obj, cb) → {Promise}
-
Update a Webhook.
Parameters:
Name Type Argument Description objWebhook a Webhook object. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise