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 email
string the webhooks email. must be a valid mail address. event_types
Array.<string> includes a set of webhook event types as strings. cb
Object <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 url
string the url of the webhook event_types
Array.<string> includes a set of webhook event types as strings. cb
Object <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 obj
string | Webhook a Webhook object or its id. note, if you set a Webhook object it will be updated, no new object will be created. cb
Object <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 count
string | number <optional>
limit of objects to be listed. use for pagination. offset
string | number <optional>
offset. use for pagination. filter
Webhook.Filter | null <optional>
a list filter or null. order
Webhook.Order | null <optional>
a list order or null. cb
Object <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 obj
Webhook a Webhook object or its id. cb
Object <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 obj
Webhook a Webhook object. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise