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

Creates and retrieves Stripe customers. More...

#include <Client.h>

Public Types

using CreateCompletion = std::function<void(CallbackResult<Customer>)>
 Completion callback for the callback form of create().
using RetrieveCompletion = std::function<void(CallbackResult<Customer>)>
 Completion callback for the callback form of retrieve().

Public Member Functions

virtual ~Customers ()=default
 Destroys the API instance.
virtual Task< Customer > create_async (const CreateCustomerRequest &request, const RequestOptions &options={})=0
 Creates a customer in Stripe.
virtual void create (const CreateCustomerRequest &request, const RequestOptions &options, CreateCompletion completion)=0
 Creates a customer, reporting the result through a callback.
virtual Task< Customer > retrieve_async (std::string customer_id, const RequestOptions &options={})=0
 Fetches an existing customer.
virtual void retrieve (std::string customer_id, const RequestOptions &options, RetrieveCompletion completion)=0
 Fetches an existing customer, reporting the result through a callback.

Detailed Description

Creates and retrieves Stripe customers.

Reach an instance through StripeClient::customers(). A Stripe customer is the object everything else hangs off, so create one per application user and store the resulting id; do not create a fresh customer per checkout.

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

Definition at line 149 of file Client.h.

Member Typedef Documentation

◆ CreateCompletion

Completion callback for the callback form of create().

Definition at line 152 of file Client.h.

◆ RetrieveCompletion

Completion callback for the callback form of retrieve().

Definition at line 155 of file Client.h.

Constructor & Destructor Documentation

◆ ~Customers()

virtual stripekit::Customers::~Customers ( )
virtualdefault

Destroys the API instance.

Member Function Documentation

◆ create_async()

virtual Task< Customer > stripekit::Customers::create_async ( const CreateCustomerRequest & request,
const RequestOptions & options = {} )
pure virtual

Creates a customer in Stripe.

Parameters
requestDetails of the customer to create.
optionsPer-request settings such as an idempotency key.
Returns
A task producing the created customer, including its Stripe id.
Exceptions
StripeApiExceptionStripe rejected the request.

◆ create()

virtual void stripekit::Customers::create ( const CreateCustomerRequest & request,
const RequestOptions & options,
CreateCompletion completion )
pure virtual

Creates a customer, reporting the result through a callback.

Use this in code that is not using coroutines; create_async() is otherwise preferable. The callback is invoked exactly once, and may run on a different thread than the caller.

Parameters
requestDetails of the customer to create.
optionsPer-request settings such as an idempotency key.
completionReceives the created customer or the failure.

◆ retrieve_async()

virtual Task< Customer > stripekit::Customers::retrieve_async ( std::string customer_id,
const RequestOptions & options = {} )
pure virtual

Fetches an existing customer.

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

◆ retrieve()

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

Fetches an existing customer, reporting the result through a callback.

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

Parameters
customer_idStripe customer id, of the form "cus_...".
optionsPer-request settings such as a timeout.
completionReceives the customer or the failure.

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