13#include "StripeKit/Async.h"
14#include "StripeKit/Models.h"
15#include "StripeKit/RequestOptions.h"
21#include <unordered_map>
49 std::unordered_map<std::string, std::string>
metadata;
72 std::string
mode =
"subscription";
113 std::unordered_map<std::string, std::string>
metadata;
137template <
typename TResult>
359 virtual void cancel(std::string subscription_id,
Creates billing portal sessions.
std::function< void(CallbackResult< BillingPortalSession >)> CreateCompletion
Completion callback for the callback form of create().
virtual void create(const CreateBillingPortalSessionRequest &request, const RequestOptions &options, CreateCompletion completion)=0
Creates a billing portal session, reporting the result through a callback.
virtual Task< BillingPortalSession > create_async(const CreateBillingPortalSessionRequest &request, const RequestOptions &options={})=0
Creates a billing portal session.
virtual ~BillingPortalSessions()=default
Destroys the API instance.
Groups the billing portal operations.
virtual BillingPortalSessions & sessions()=0
Returns the billing portal session operations.
virtual ~BillingPortal()=default
Destroys the API instance.
Creates Stripe-hosted Checkout sessions.
virtual ~CheckoutSessions()=default
Destroys the API instance.
virtual Task< CheckoutSession > create_async(const CreateCheckoutSessionRequest &request, const RequestOptions &options={})=0
Creates a Checkout session.
virtual void create(const CreateCheckoutSessionRequest &request, const RequestOptions &options, CreateCompletion completion)=0
Creates a Checkout session, reporting the result through a callback.
std::function< void(CallbackResult< CheckoutSession >)> CreateCompletion
Completion callback for the callback form of create().
Groups the Checkout operations.
virtual ~Checkout()=default
Destroys the API instance.
virtual CheckoutSessions & sessions()=0
Returns the Checkout session operations.
Creates and retrieves Stripe customers.
virtual void retrieve(std::string customer_id, const RequestOptions &options, RetrieveCompletion completion)=0
Fetches an existing customer, reporting the result through a callback.
std::function< void(CallbackResult< Customer >)> CreateCompletion
Completion callback for the callback form of create().
std::function< void(CallbackResult< Customer >)> RetrieveCompletion
Completion callback for the callback form of retrieve().
virtual Task< Customer > retrieve_async(std::string customer_id, const RequestOptions &options={})=0
Fetches an existing customer.
virtual void create(const CreateCustomerRequest &request, const RequestOptions &options, CreateCompletion completion)=0
Creates a customer, reporting the result through a callback.
virtual Task< Customer > create_async(const CreateCustomerRequest &request, const RequestOptions &options={})=0
Creates a customer in Stripe.
virtual ~Customers()=default
Destroys the API instance.
The entry point for talking to Stripe.
virtual Customers & customers()=0
Returns the customer operations.
virtual Checkout & checkout()=0
Returns the Checkout operations.
virtual ~StripeClient()=default
Destroys the client instance.
virtual Subscriptions & subscriptions()=0
Returns the subscription operations.
virtual BillingPortal & billing_portal()=0
Returns the billing portal operations.
Retrieves and cancels Stripe subscriptions.
virtual ~Subscriptions()=default
Destroys the API instance.
std::function< void(CallbackResult< Subscription >)> RetrieveCompletion
Completion callback for the callback form of retrieve().
virtual void cancel(std::string subscription_id, const RequestOptions &options, CancelCompletion completion)=0
Cancels a subscription, reporting the result through a callback.
std::function< void(CallbackResult< Subscription >)> CancelCompletion
Completion callback for the callback form of cancel().
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 Task< Subscription > retrieve_async(std::string subscription_id, const RequestOptions &options={})=0
Fetches a subscription and its current status.
The result of an asynchronous StripeKit operation.
std::variant< TResult, std::exception_ptr > CallbackResult
Result passed to a completion callback: either the value, or the failure.
Describes the billing portal session to create.
std::string return_url
Where Stripe sends the customer when they leave the portal.
std::string customer_id
Id of the Stripe customer who should manage their billing.
Describes the Checkout session to create.
std::string currency
ISO currency code for inline pricing, for example "usd".
std::string recurring_interval
Billing interval for inline pricing in subscription mode: "day", "week", "month", or "year".
std::string mode
Mode of the Checkout session: "subscription" or "payment".
std::int64_t unit_amount
Amount per unit for inline pricing, in the currency's smallest unit.
std::int64_t quantity
Number of units of the item to bill for.
std::string success_url
Where Stripe sends the customer's browser after a successful checkout.
std::string cancel_url
Where Stripe sends the customer's browser if they abandon checkout.
std::unordered_map< std::string, std::string > metadata
Free-form key/value pairs to store on the session.
std::string price_id
Id of an existing Stripe Price.
std::string customer_id
Id of an existing Stripe customer to bill.
std::string product_name
Product name, for inline pricing.
Describes the customer to create.
std::string name
Customer display name, as it should appear in the Stripe dashboard.
std::string email
Customer email address.
std::unordered_map< std::string, std::string > metadata
Free-form key/value pairs to store on the customer.
Per-call settings accepted by every client operation.