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

The response parser StripeKit uses by default. More...

#include <StripeApiClient.h>

Inheritance diagram for stripekit::JsonStripeResponseParser:
[legend]

Public Member Functions

Customer parse_customer (const HttpResponse &response) const override
 Reads a customer out of a successful response.
CheckoutSession parse_checkout_session (const HttpResponse &response) const override
 Reads a Checkout session out of a successful response.
Subscription parse_subscription (const HttpResponse &response) const override
 Reads a subscription out of a successful response.
BillingPortalSession parse_billing_portal_session (const HttpResponse &response) const override
 Reads a billing portal session out of a successful response.
StripeErrorPayload parse_error (const HttpResponse &response) const override
 Reads the error details out of a failed response.
Public Member Functions inherited from stripekit::StripeResponseParser
virtual ~StripeResponseParser ()=default
 Destroys the parser instance.

Detailed Description

The response parser StripeKit uses by default.

Decodes Stripe's JSON with JsonCpp. Applications get this automatically and only need to think about it when supplying a parser of their own.

Definition at line 94 of file StripeApiClient.h.

Member Function Documentation

◆ parse_customer()

Customer stripekit::JsonStripeResponseParser::parse_customer ( const HttpResponse & response) const
overridevirtual

Reads a customer out of a successful response.

Parameters
responseThe response body and status from Stripe.
Returns
The parsed customer.
Exceptions
ConfigurationExceptionThe body was not valid JSON, or not a customer.

Implements stripekit::StripeResponseParser.

◆ parse_checkout_session()

CheckoutSession stripekit::JsonStripeResponseParser::parse_checkout_session ( const HttpResponse & response) const
overridevirtual

Reads a Checkout session out of a successful response.

Parameters
responseThe response body and status from Stripe.
Returns
The parsed session.
Exceptions
ConfigurationExceptionThe body was not valid JSON, or not a session.

Implements stripekit::StripeResponseParser.

◆ parse_subscription()

Subscription stripekit::JsonStripeResponseParser::parse_subscription ( const HttpResponse & response) const
overridevirtual

Reads a subscription out of a successful response.

Parameters
responseThe response body and status from Stripe.
Returns
The parsed subscription.
Exceptions
ConfigurationExceptionThe body was not valid JSON, or not a subscription.

Implements stripekit::StripeResponseParser.

◆ parse_billing_portal_session()

BillingPortalSession stripekit::JsonStripeResponseParser::parse_billing_portal_session ( const HttpResponse & response) const
overridevirtual

Reads a billing portal session out of a successful response.

Parameters
responseThe response body and status from Stripe.
Returns
The parsed session.
Exceptions
ConfigurationExceptionThe body was not valid JSON, or not a session.

Implements stripekit::StripeResponseParser.

◆ parse_error()

StripeErrorPayload stripekit::JsonStripeResponseParser::parse_error ( const HttpResponse & response) const
overridevirtual

Reads the error details out of a failed response.

Parameters
responseThe response body and status from Stripe.
Returns
The error details, falling back to StripeErrorType::Unknown when the body cannot be parsed.

Implements stripekit::StripeResponseParser.


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