StripeKit 0.1.1
Stripe integration toolkit for C++
Loading...
Searching...
No Matches
stripekit::Subscriptions Class Referenceabstract

Retrieves and cancels Stripe subscriptions. More...

#include <Client.h>

Public Types

using RetrieveCompletion = std::function<void(CallbackResult<Subscription>)>
 Completion callback for the callback form of retrieve().
using CancelCompletion = std::function<void(CallbackResult<Subscription>)>
 Completion callback for the callback form of cancel().

Public Member Functions

virtual ~Subscriptions ()=default
 Destroys the API instance.
virtual Task< Subscription > retrieve_async (std::string subscription_id, const RequestOptions &options={})=0
 Fetches a subscription and its current status.
virtual void retrieve (std::string subscription_id, const RequestOptions &options, RetrieveCompletion completion)=0
 Fetches a subscription, reporting the result through a callback.
virtual Task< Subscription > cancel_async (std::string subscription_id, const RequestOptions &options={})=0
 Cancels a subscription immediately.
virtual void cancel (std::string subscription_id, const RequestOptions &options, CancelCompletion completion)=0
 Cancels a subscription, reporting the result through a callback.

Detailed Description

Retrieves and cancels Stripe subscriptions.

Reach an instance through StripeClient::subscriptions(). Subscriptions are created by Checkout rather than here; this interface covers inspecting one and ending it.

See also
https://docs.stripe.com/api/subscriptions

Definition at line 292 of file Client.h.

Member Typedef Documentation

◆ RetrieveCompletion

Completion callback for the callback form of retrieve().

Definition at line 295 of file Client.h.

◆ CancelCompletion

Completion callback for the callback form of cancel().

Definition at line 298 of file Client.h.

Constructor & Destructor Documentation

◆ ~Subscriptions()

virtual stripekit::Subscriptions::~Subscriptions ( )
virtualdefault

Destroys the API instance.

Member Function Documentation

◆ retrieve_async()

virtual Task< Subscription > stripekit::Subscriptions::retrieve_async ( std::string subscription_id,
const RequestOptions & options = {} )
pure virtual

Fetches a subscription and its current status.

This reports what Stripe believes right now, which is useful for reconciliation. For day-to-day access decisions, follow the webhooks instead of polling.

Parameters
subscription_idStripe subscription id, of the form "sub_...".
optionsPer-request settings such as a timeout.
Returns
A task producing the subscription.
Exceptions
StripeApiExceptionNo such subscription, or Stripe rejected the request.

◆ retrieve()

virtual void stripekit::Subscriptions::retrieve ( std::string subscription_id,
const RequestOptions & options,
RetrieveCompletion completion )
pure virtual

Fetches a subscription, reporting the result through a callback.

The callback is invoked exactly once, and may run on a different thread than the caller.

Parameters
subscription_idStripe subscription id, of the form "sub_...".
optionsPer-request settings such as a timeout.
completionReceives the subscription or the failure.

◆ cancel_async()

virtual Task< Subscription > stripekit::Subscriptions::cancel_async ( std::string subscription_id,
const RequestOptions & options = {} )
pure virtual

Cancels a subscription immediately.

Billing stops at once rather than at the end of the paid period. Stripe sends a customer.subscription.deleted webhook, which is where access should actually be revoked.

Parameters
subscription_idStripe subscription id, of the form "sub_...".
optionsPer-request settings such as an idempotency key.
Returns
A task producing the subscription in its cancelled state.
Exceptions
StripeApiExceptionStripe rejected the request.

◆ cancel()

virtual void stripekit::Subscriptions::cancel ( std::string subscription_id,
const RequestOptions & options,
CancelCompletion completion )
pure virtual

Cancels a subscription, reporting the result through a callback.

The callback is invoked exactly once, and may run on a different thread than the caller.

Parameters
subscription_idStripe subscription id, of the form "sub_...".
optionsPer-request settings such as an idempotency key.
completionReceives the cancelled subscription or the failure.

The documentation for this class was generated from the following file: