Package com.flutterwave.services
Class Subscriptions
java.lang.Object
com.flutterwave.services.Subscriptions
API endpoints that are critical for managing user subscriptions.
With these APIs, You can query your existing subscriptions, as well as activate or deactivate a user's subscription.
- Author:
- Cleopatra Douglas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactivateSubscription(int id) Activate a previously cancelled subscription.deactivateSubscription(int id) Deactivate an active subscription.getAllSubscriptions(Optional<String> email, Optional<Integer> transaction_id, Optional<Integer> plan, Optional<String> subscribed_from, Optional<String> subscribed_to, Optional<String> next_due_from, Optional<String> next_due_to, Optional<String> page, Optional<String> status) Query all subscribers (cancelled subscriber included).
-
Constructor Details
-
Subscriptions
public Subscriptions()
-
-
Method Details
-
getAllSubscriptions
public ListResponse getAllSubscriptions(Optional<String> email, Optional<Integer> transaction_id, Optional<Integer> plan, Optional<String> subscribed_from, Optional<String> subscribed_to, Optional<String> next_due_from, Optional<String> next_due_to, Optional<String> page, Optional<String> status) Query all subscribers (cancelled subscriber included). You can do a single or bulk query with the endpoint depending on your use case.- Parameters:
email- Optional This is the email of the subscriber. You can use this to query the transactions for a single customer.transaction_id- Optional This is a unique transaction identifier generated by our systems. It is returned in the initiate charge response as data.id.plan- Optional This is the ID of the payment plan. It is returned in the call to create a payment plan as data.id.subscribed_from- Optional This is the start date of the subscriptions(when they are first active). You can use this as a starting point for your query. The expected date format for this parameter is YYYY-MM-DDsubscribed_to- Optional This is the end date for a subscription. Like subscribed_from, It also has an expected date format of YYYY-MM-DD.next_due_from- Optional This is the parameter to filter from the start date of the next due subscriptions.next_due_to- Optional This is the parameter to filter to the end date of the next due subscriptions.page- Optional This is the page number to retrieve e.g. setting 1 retrieves the first page.status- Optional This is the status for the queried transactions. Expected values are active and cancelled.- Returns:
- ListResponse
-
activateSubscription
Activate a previously cancelled subscription.- Parameters:
id- int This is the ID of the subscription you want to activate. It is returned in the call to query all subscription as data.id.- Returns:
- Response
-
deactivateSubscription
Deactivate an active subscription.- Parameters:
id- int This is the ID of the subscription to be cancelled. It is returned in the call to query all subscription as data.id.- Returns:
- Response
-