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 objstring | Client a Client object. cbObject <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 amountstring | number Amount (in cents). currencystring ISO 4217 formatted currency code intervalstring | Interval Defining how often the client should be charged. Format: number DAY|WEEK|MONTH|YEAR Example: 2 DAY namestring Your name for this offer trial_period_daysnumber <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 objstring | Offer a Offer object or its id. note, if you set a Offer 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 Offer or rejected with a PMError.- Type
- Promise
-
list(count, offset, filter, order, cb) → {Promise}
-
List Offers.
Parameters:
Name Type Argument Description countstring | number <optional>
limit of objects to be listed. use for pagination. offsetstring | number <optional>
offset. use for pagination. filterOffer.Filter | null <optional>
a list filter or null. orderOffer.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, removeWithSubscriptions, cb) → {Promise}
-
Remove an Offer.
Parameters:
Name Type Argument Description objOffer a Offer object or its id. removeWithSubscriptionsboolean if true, the plan and all subscriptions associated with it will be deleted. If false, only the plan will be deleted. cbObject <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 objstring | Offer a Offer object. cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Offer or rejected with a PMError.- Type
- Promise