SubscriptionService class
URL: https://developer.squareup.com/reference/square/subscriptions-api/create-subscription
Creates a subscription to a subscription plan by a customer.
If you provide a card on file in the request, Square charges the card for the subscription. Otherwise, Square bills an invoice to the customer's email address. The subscription starts immediately, unless the request includes the optional start_date. Each individual subscription is associated with a particular location.
Constructors
- SubscriptionService.new({required String baseUrl, required AuthenticationService authenticationService})
Properties
- authenticationService → AuthenticationService
-
final
- baseUrl → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelSubscription(
{required int subscriptionId, String? authToken}) → Future< SubscriptionResponse> - Schedules a CANCEL action to cancel an active subscription by setting the canceled_date field to the end of the active billing period and changing the subscription status from ACTIVE to CANCELED after this date.
-
createSubscription(
{required CreateSubscriptionRequest request, String? authToken}) → Future< Subscription> - Creates a subscription to a subscription plan by a customer.
-
deleteSubscription(
{required int subscriptionId, required String actionId, String? authToken}) → Future< Subscription> - Deletes a scheduled action for a subscription.
-
listSubscriptionEvents(
{required int subscriptionId, String? cursor, int? limit, String? authToken}) → Future< List< SubscriptionEvent> > - Lists all events for a specific subscription.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pauseSubscription(
{required String subscriptionId, required SubscriptionStateRequest request, String? authToken}) → Future< SubscriptionResponse> - Schedules a PAUSE action to pause an active subscription.
-
readSubscription(
{required String subscriptionId, String? authToken}) → Future< Subscription> - Retrieves a subscription.
-
resumeSubscription(
{required String subscriptionId, required SubscriptionStateRequest request, String? authToken}) → Future< SubscriptionResponse> - Schedules a RESUME action to resume a paused or a deactivated subscription.
-
searchSubscription(
{required SearchSubscriptionRequest request, String? authToken}) → Future< SubscriptionResponse> - Searches for subscriptions. Results are ordered chronologically by subscription creation date. If the request specifies more than one location ID, the endpoint orders the result by location ID, and then by creation date within each location. If no locations are given in the query, all locations are searched.
-
swapPlan(
{required String subscriptionId, required String newPlanId, String? authToken}) → Future< Subscription> - Schedules a SWAP_PLAN action to swap a subscription plan in an existing subscription.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateSubscription(
{required int subscriptionId, required Subscription request, String? authToken}) → Future< Subscription> - Updates a subscription.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited