new OfferService()
Creates a new OfferService. Generally you should never create a PAYMILL service on your own. Instead use the exported "offers".
- Source:
Methods
-
<static> ClientService#update(obj, cb) → {Promise}
-
Update an Client.
Parameters:
Name Type Argument Description obj
string | Client a Client object. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Offer or rejected with a PMError.- Type
- Promise
-
create(amount, currency, interval, name, trial_period_days) → {Promise}
-
This function creates a Offer object.
Parameters:
Name Type Argument Description amount
string | number Amount (in cents). currency
string ISO 4217 formatted currency code interval
string | Interval Defining how often the client should be charged. Format: number DAY|WEEK|MONTH|YEAR Example: 2 DAY name
string Your name for this offer trial_period_days
number <optional>
Give it a try or charge directly? Default is 0 - Source:
Returns:
a promise, which will be fulfilled with a Offer or rejected with a PMError.- Type
- Promise
-
detail(obj, cb) → {Promise}
-
Get an Offer.
Parameters:
Name Type Argument Description obj
string | Offer a Offer object or its id. note, if you set a Offer 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 Offer or rejected with a PMError.- Type
- Promise
-
list(count, offset, filter, order, cb) → {Promise}
-
List Offers.
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
Offer.Filter | null <optional>
a list filter or null. order
Offer.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, removeWithSubscriptions, cb) → {Promise}
-
Remove an Offer.
Parameters:
Name Type Argument Description obj
Offer a Offer object or its id. removeWithSubscriptions
boolean if true, the plan and all subscriptions associated with it will be deleted. If false, only the plan will be deleted. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Offer or rejected with a PMError.- Type
- Promise
-
update(obj, cb) → {Promise}
-
Update an Offer.
Parameters:
Name Type Argument Description obj
string | Offer a Offer object. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Offer or rejected with a PMError.- Type
- Promise