API Method Arguments Returns Description
getItem(Integer itemId, Integer userId, String pricing)
Item ID, User ID, Pricing string
ItemDTOEx Returns the item for the given ID.
getAllItems() ItemDTOEx Returns an array of all items in the system. createItem(ItemDTOEx item) ItemDTOEx Integer Save the given item and returns the new
ID.
updateItem(ItemDTOEx item) ItemDTOEx Updates the stored item details to match the given item. Given item must have an ID.
deleteItem(Integer itemId) Item ID Deletes the given item. getItemByCategory(Integer
itemTypeId)
Item Type ID ItemDTOEx Returns an array of items belonging to the given item type.
getUserItemsByCategory(Inte ger userId, Integer categoryId)
User ID, Item Type ID
Integer Returns all items for the given category that can be found on an active order for the given user.
getAllItemCategories() ItemTypeWS Returns an array of all item types in the system.
createItemCategory(ItemType WS itemType)
ItemTypeWS Integer Saves the given item type and returns the newly created object.
updateItemCategory(ItemType WS itemType)
ItemTypeWS Updates the stored item type and returns the updated object. Given item type must have an ID.
deleteItemCategory(Integer itemCategoryId)
isUserSubscribedTo(Integer userId, Integer itemId)
User ID, Item ID String Returns the total quantity of an item found on a users active recurring orders.
getLatestInvoiceByItemType(I nteger userId, Integer itemTypeId)
User ID, Item Type ID
InvoiceWS Returns the latest invoice for a user containing an item of the given type. getLastInvoicesByItemType(In
teger userId, Integer itemTypeId, Integer number)
User ID, Item Type ID, Integer number
Integer Returns the last N invoice IDs containing an item of the given type for a user. getLatestOrderByItemType(Int
eger userId, Integer itemTypeId)
User Id, Item Type ID
OrderWS Returns the latest order for a user containing an item of the given type. getLastOrdersByItemType(Inte
ger userId, Integer itemTypeId, Integer number)
User ID, Item Type ID, Integer number
Integer Returns the last N order IDs containing an item of the given type for a user.
getUserOrdersPage(Integer user, Integer limit, Integer offset)
User, Limit, Offset OrderWS Returns an array of orderws between the given range for the given user.
validatePurchase(Integer userId, Integer itemId, String fields)
User ID, Item ID, Pricing string
ValidatePurcha seWS
Runs pricing and item management plugins in a mock purchase for the given user and item ID.
validateMultiPurchase(Integer userId, Integer itemId, String fields)
User ID, Array of Item ID ValidatePurcha seWS Runs multiple mock purchases.
Payment API Methods
API Method Arguments Returns Description
getPayment(Integer paymentId)
getLatestPayment(Integer userId)
User ID PaymentWS Returns the most recent payment for the given user.
getLastPayments(Integer userId, Integer number)
User ID, number of payments
Integer Returns the last N payment IDs for the given user.
getTotalRevenueByUser(Integ er userId)
User ID BigDecimal Returns the total revenue (payments recieved) for the given user.
getUserPaymentInstrument(Int eger userId)
User ID PaymentWS Returns the selected "automatic payment" details for the given user.
getUserPaymentsPage(Intege r userId, Integer limit, Integer offset)
User ID, Limit, Offset
PaymentWS Returns an array of paymentWS between the given range for the given user id. createPayment(PaymentWS
payment)
PaymentWS Integer Saves the given payment and applies it to the user's account (as per configured entity preferences). Does not process the payment, only creates it as 'Entered'. updatePayment(PaymentWS
payment)
PaymentWS Updates the stored payment to match the details in the given payment. Given payment must have an ID. deletePayment(Integer paymentId) Payment ID Deletes the given payment. removePaymentLink(Integer invoiceId, Integer paymentId) Invoice ID, Payment ID
Remove the link between a payment and invoice (unpay the invoice).
removeAllPaymentLinks(Integ er paymentId)
Payment ID Removes all the links between a payment and invoice.
createPaymentLink(Integer invoiceId, Integer paymentId)
Invoice ID, Payment ID
Link the payment to an invoice (pay the invoice).
payInvoice(Integer invoiceId) Invoice ID PaymentAuthori zationDTOEx
Pays the given invoice using the first credit card available for the invoiced user.
applyPayment(PaymentWS payment, Integer invoiceId)
PaymentWS, Invoice ID
Integer Saves the given payment and applies it to the given invoice. Does not process the payment, only creates it as 'Entered'. processPayment(PaymentWS payment, Integer invoiceId) PaymentWS, Invoice ID PaymentAuthori zationDTOEx
Saves and processes the payment, applying it to the given invoice. If no payment is given, the payment will be created using the users "automatic payment" instrument. If no invoice is given, the payment will be applied to the user's account according to the configured entity preferences. validateCreditCard(com.sapie nter.jbilling.server.entity.Credit CardDTO creditCard, ContactWS contact, int level) CreditCardDTO, ContactWS, Level in number (1/2/3) CardValidation WS
Level 1 Simple checks on Credit Card Number, name, and mod10.
Level 2 Address and Security Code validation. Level 3 Check number against a payment gateway using preauth transaction. Returns object of CardValidationWS.
User API Methods
API Method Arguments Returns Description
getUserWS(Integer userId) User ID UserWS Returns the user for the given ID.
createUser(UserWS newUser) UserWS Integer Creates a new user from given UserWS object & returns User ID of the created user.
updateUser(UserWS user) UserWS Updates the stored user details to match the given user object. Given user must have an ID.
getUserContactsWS(Integer userId)
User ID ContactWS Returns all contact details for the given user.
updateUserContact(Integer userId, Integer typeId, ContactWS contact)
User ID, Contact Type ID, ContactWS
Updates the contact details of the given user. getContactTypeWS(Integer contactTypeId) Contact Type ID ContactTypeW S Returns the contact type for the given ID. createContactTypeWS(Contac tTypeWS contactType)
ContactTypeWS Integer Saves the given contact type and returns the new ID.
updateCreditCard(Integer userId, CreditCardDTO creditCard)
User ID, Credit Card
Updates the given users credit card data.
updateAch(Integer userId, AchDTO ach)
User ID, ACH Updates the given users ACH (automatic clearing house) data.
setAuthPaymentType(Integer userId, Integer autoPaymentType, boolean use)
User ID, Payment Type, use type?
Marks the users Credit Card or ACH details as being usable for automatic payments.
getAuthPaymentType(Integer userId)
User ID Integer Returns the users preferred automatic payment type.
getUsersByStatus(Integer statusId, boolean in)
Status ID, in/ not in status
Integer If "in" true, returns a list of users who are in the givens status, if false, a list of users who are NOT in the given status.
getUsersInStatus(Integer statusId)
Status ID Integer Array of user IDs who are in the given status.
getUsersNotInStatus(Integer statusId)
Status ID Integer Array of user IDs who are not in the given status.
getUsersByCustomField(Integ er typeId, String value)
Type ID, Value to match
Integer Array of user IDs who have a custom contact field with the given value.
getUsersByCreditCard(String number)
Credit Card number
Integer Array of user IDs who have the given credit card ID.
getUserId(String username) User name Integer Returns the user id for the given user name.
saveCustomContactFields(Co ntactFieldTypeWS fields)
ContactFieldType WS
Updates the available custom contact fields for the system.
processPartnerPayouts(Date runDate)
Run Date Runs the parter payout process for the given date.
getPartner(Integer partnerId) Patner ID PartnerWS Returns the partner for the given ID. getUserTransitions(Date from,
Date to)
Date range UserTransition ResponseWS
Returns an array of user transitions (status changes) for the givend date range. getUserTransitionsAfterId(Inte
ger id)
User ID UserTransition ResponseWS
Returns an array of user transitions (status changes) for the given user ID.
create(UserWS user, OrderWS order)
UserWS, OrderWS CreateRespons eWS
Saves a new user and order and immediately generates a new invoice for the created user and order. Returns the ID's of the created objects. saveCustomerNotes(Integer userId, String notes) User ID, Notes Updates the given users notes. userExistsWithName(String userName)
User Name Boolean Returns true if a user exists with the given user name, false if not.
userExistsWithId(Integer userId)
User ID Boolean Returns true if a user with the given ID exists, false if not. getUserIdByEmail(String email) Email ID Integer
Retrieves user by the user's email. This is only valid if Jbilling is configured to force unique emails per user/customers in the company. If unique emails are not forced then an exception is thrown and in such case this method should not be used.
Returns user ID of the user with given email.
triggerPartnerPayoutProcess( Date runDate)
Run Date Processes partner payouts for all partners that have a payout due before the given run date.
processPartnerPayout(Integer partnerId)
Partner ID Process partner payout for a single given partner ID.
createPartner(UserWS newUser, PartnerWS partner)
UserWS, PartnerWS
Integer Creates new Partner using PartnerWS, sets meta fields values from UserWS & returns User Id.
updatePartner(UserWS newUser, PartnerWS partner)
UserWS, PartnerWS
Update user & set meta fields using UserWS. Update partner using PartnerWS. deletePartner(Integer
partnerId)
Partner ID Deletes the composed Partner object from the system by first deleting the associated user and then deleting the Partner record. deleteCreditCard(Integer
userId)
User ID Deletes a users stored credit card using User ID. Payments that were made using the deleted credit card will not be affected. deleteAch(Integer userId)
User ID Deletes a users stored ACH details using User ID. Payments that were made using the deleted ACH details will not be affected.
getAutoPaymentType(Integer userId)
User ID Integer Returns Auto Payment Type using User ID.
setAutoPaymentType(Integer userId, Integer autoPaymentType, boolean use)
User ID, Auto Payment Type, Use
Set Auto Payment Type using User ID, Auto Payment Type, Use.