Overview of Subscription API Calls
Problem
Users need to understand the available Subscription API calls and their purposes for managing subscriptions within the Plus2 database.
Resolution
Assign a Subscription to a Member
- Call
AssignSubTypeToMember(int memberId, string subTypeId, DateTime startDate, string siteId)to assign a subscription to a member. - This will leave an unpaid debt on the member’s account. If payment has been received, use
SetMemberSubPaidto mark it as paid.
- Call
Assign a Subscription with Specific End Date
- Use
AssignSubTypeToMemberDate(int memberId, string subTypeId, DateTime startDate, string siteId, DateTime earliestEndDate)to behave as above, but also specify the earliest end date.
- Use
Assign a Subscription with Additional Details
- Use
AssignSubTypeToMemberWithDetails(obj requestDetails)to:- Allocate an unpaid subscription to a member for a given start date.
- Set the earliest end date and renewal stop date.
- Returns the relevant subscription and invoice details.
- Use
Decrement Subscription Usages
- Call
DecrementUsagesOnSub(int memberId, int subscriptionRef, int usageCount, string transactionId)to decrease the number of usages for a subscription by a given amount. - The
transactionIdmust be unique and cannot be reused. This is to prevent multiple identical calls for a single transaction. - If configuration allows, this method may also be used to increment usage counts.
- Call
Retrieve Available Subscriptions
- Use
GetAllAvailableSubs(int memberId, string siteId, bool webBookableOnly)to retrieve available subscription types for purchase. - Set
memberIdto 0 to view options for non-members. siteIdcan be a single site or a comma-separated list of sites.- Note: This method is due to be deprecated. Use
GetAvailableSubsByStartDateinstead.
- Use
Retrieve Subscriptions with Additional Details
- Use
GetAvailableSubsByStartDate(obj request)to get the same results as above, plus additional price information and the next collection date.
- Use
Mark a Subscription as Paid
- Call
SetMemberSubPaid(int memberId, string subscriptionRef, bool payAll, int externalAuditId)to set a subscription’s status to paid. - If
payAllis true, all invoices linked to the subscription will be paid off. If false, only those that are due will be paid.
- Call
Stop Subscription Renewal
- Use
StopSubscriptionRenewal()to set therenewalStopDate, allowing start-of-day procedures to stop the subscription. - It is recommended to set the
AdhereToEarliestEndDateparameter to true in the request. - This returns a
SuccessFailureWithMessage.
- Use
Notes
- The use of unique
transactionIdinDecrementUsagesOnSubprevents duplicate processing of a single transaction. GetAllAvailableSubsis being replaced byGetAvailableSubsByStartDate. Use the newer method for enhanced information.- For stopping renewals, setting
AdhereToEarliestEndDateto true is recommended for correct behavior.