Package com.stripe
Class StripeClient
java.lang.Object
com.stripe.StripeClient
This is the primary entrypoint to make requests against Stripe's API. It provides a means of
accessing all the methods on the Stripe API, and the ability to set configuration such as apiKey
and connection timeouts.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionStripeClient
(StripeResponseGetter responseGetter) Constructs a StripeClient with a custom StripeResponseGetter.StripeClient
(String apiKey) Constructs a StripeClient with default settings, using the provided API key. -
Method Summary
Modifier and TypeMethodDescriptionaccounts()
apps()
balance()
billing()
builder()
Builder class for creating aStripeClient
instance.charges()
checkout()
climate()
constructEvent
(String payload, String sigHeader, String secret) Returns an Event instance using the provided JSON payload.constructEvent
(String payload, String sigHeader, String secret, long tolerance) Returns an Event instance using the provided JSON payload.coupons()
deserialize
(String rawJson, ApiMode apiMode) Deserializes StripeResponse returned by rawRequest into a similar class.disputes()
events()
files()
protected StripeResponseGetter
identity()
invoices()
issuing()
mandates()
parseThinEvent
(String payload, String sigHeader, String secret) Returns an StripeEvent instance using the provided JSON payload.parseThinEvent
(String payload, String sigHeader, String secret, long tolerance) Returns an StripeEvent instance using the provided JSON payload.payouts()
plans()
prices()
products()
quotes()
radar()
rawRequest
(ApiResource.RequestMethod method, String relativeUrl, String content) Send raw request to Stripe API.rawRequest
(ApiResource.RequestMethod method, String relativeUrl, String content, RawRequestOptions options) Send raw request to Stripe API.refunds()
reviews()
sigma()
sources()
tax()
taxCodes()
taxIds()
taxRates()
terminal()
tokens()
topups()
treasury()
v2()
-
Constructor Details
-
StripeClient
Constructs a StripeClient with default settings, using the provided API key. Use the builder instead if you require more complex configuration. -
StripeClient
Constructs a StripeClient with a custom StripeResponseGetter.Use this for testing, or advanced use cases where you need to make fundamental changes to how the StripeClient makes requests.
-
-
Method Details
-
getResponseGetter
-
parseThinEvent
public ThinEvent parseThinEvent(String payload, String sigHeader, String secret) throws SignatureVerificationException Returns an StripeEvent instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.- Returns:
- the StripeEvent instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
parseThinEvent
public ThinEvent parseThinEvent(String payload, String sigHeader, String secret, long tolerance) throws SignatureVerificationException Returns an StripeEvent instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.tolerance
- number of seconds that the event's timestamp can differ from the system time. Passing `0` will disable the time check entirely and is **strongly discouraged**.- Returns:
- the StripeEvent instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
constructEvent
public Event constructEvent(String payload, String sigHeader, String secret) throws SignatureVerificationException Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.- Returns:
- the Event instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
constructEvent
public Event constructEvent(String payload, String sigHeader, String secret, long tolerance) throws SignatureVerificationException Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.tolerance
- maximum difference in seconds allowed between the header's timestamp and the current time- Returns:
- the Event instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
accountLinks
-
accountSessions
-
accounts
-
applePayDomains
-
applicationFees
-
apps
-
balance
-
balanceTransactions
-
billing
-
billingPortal
-
charges
-
checkout
-
climate
-
confirmationTokens
-
countrySpecs
-
coupons
-
creditNotes
-
customerSessions
-
customers
-
disputes
-
entitlements
-
ephemeralKeys
-
events
-
exchangeRates
-
fileLinks
-
files
-
financialConnections
-
forwarding
-
identity
-
invoiceItems
-
invoicePayments
-
invoiceRenderingTemplates
-
invoices
-
issuing
-
mandates
-
paymentIntents
-
paymentLinks
-
paymentMethodConfigurations
-
paymentMethodDomains
-
paymentMethods
-
payouts
-
plans
-
prices
-
products
-
promotionCodes
-
quotes
-
radar
-
refunds
-
reporting
-
reviews
-
setupAttempts
-
setupIntents
-
shippingRates
-
sigma
-
sources
-
subscriptionItems
-
subscriptionSchedules
-
subscriptions
-
tax
-
taxCodes
-
taxIds
-
taxRates
-
terminal
-
testHelpers
-
tokens
-
topups
-
transfers
-
treasury
-
v2
-
webhookEndpoints
-
builder
Builder class for creating aStripeClient
instance. Allows you to specify settings like the API key, connect and read timeouts, and proxy settings. -
rawRequest
public StripeResponse rawRequest(ApiResource.RequestMethod method, String relativeUrl, String content) throws StripeException Send raw request to Stripe API. This is the lowest level method for interacting with the Stripe API. This method is useful for interacting with endpoints that are not covered yet in stripe-java.- Parameters:
method
- the HTTP methodrelativeUrl
- the relative URL of the request, e.g. "/v1/charges"content
- the body of the request as a string- Returns:
- the JSON response as a string
- Throws:
StripeException
-
rawRequest
public StripeResponse rawRequest(ApiResource.RequestMethod method, String relativeUrl, String content, RawRequestOptions options) throws StripeException Send raw request to Stripe API. This is the lowest level method for interacting with the Stripe API. This method is useful for interacting with endpoints that are not covered yet in stripe-java.- Parameters:
method
- the HTTP methodrelativeUrl
- the relative URL of the request, e.g. "/v1/charges"content
- the body of the request as a stringoptions
- the special modifiers of the request- Returns:
- the JSON response as a string
- Throws:
StripeException
-
deserialize
Deserializes StripeResponse returned by rawRequest into a similar class.- Throws:
StripeException
-