Package com.stripe.net
Class ApiResource
java.lang.Object
com.stripe.model.StripeObject
com.stripe.net.ApiResource
- All Implemented Interfaces:
StripeObjectInterface
- Direct Known Subclasses:
Account
,Account
,AccountLink
,ApplePayDomain
,ApplicationFee
,Authorization
,Balance
,BalanceTransaction
,BankAccount
,Capability
,Card
,Card
,Cardholder
,CashBalance
,Charge
,Configuration
,Configuration
,ConnectionToken
,CountrySpec
,Coupon
,CreditNote
,CreditReversal
,Customer
,CustomerBalanceTransaction
,DebitReversal
,Dispute
,Dispute
,EarlyFraudWarning
,EphemeralKey
,Event
,ExchangeRate
,FeeRefund
,File
,FileLink
,FinancialAccount
,InboundTransfer
,Invoice
,InvoiceItem
,Location
,LoginLink
,Mandate
,OutboundPayment
,OutboundTransfer
,PagingIterator
,PaymentIntent
,PaymentLink
,PaymentMethod
,Payout
,Person
,Plan
,Price
,Product
,PromotionCode
,Quote
,Reader
,ReceivedCredit
,ReceivedDebit
,Refund
,ReportRun
,ReportType
,Review
,ScheduledQueryRun
,SearchPagingIterator
,Secret
,Session
,Session
,Session
,SetupAttempt
,SetupIntent
,ShippingRate
,Source
,Subscription
,SubscriptionItem
,SubscriptionSchedule
,TaxCode
,TaxId
,TaxRate
,TestClock
,Token
,Topup
,Transaction
,Transaction
,TransactionEntry
,Transfer
,TransferReversal
,UsageRecord
,ValueList
,ValueListItem
,VerificationReport
,VerificationSession
,WebhookEndpoint
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkNullTypedParams
(String url, ApiRequestParams params) Invalidate null typed parameters.protected static String
protected static String
protected static String
instanceUrl
(Class<?> clazz, String id) protected static String
instanceUrl
(Class<?> clazz, String id, String apiBase) static <T extends StripeObjectInterface>
Trequest
(ApiResource.RequestMethod method, String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) static <T extends StripeObjectInterface>
Trequest
(ApiResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) static <T extends StripeCollectionInterface<?>>
TrequestCollection
(String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) static <T extends StripeCollectionInterface<?>>
TrequestCollection
(String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) Similar to #request, but specific for use with collection types that come from the API (i.e.static <T extends StripeSearchResultInterface<?>>
TrequestSearchResult
(String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) static <T extends StripeSearchResultInterface<?>>
TrequestSearchResult
(String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) Similar to #request, but specific for use with searchResult types that come from the APIstatic InputStream
requestStream
(ApiResource.RequestMethod method, String url, ApiRequestParams params, RequestOptions options) static InputStream
requestStream
(ApiResource.RequestMethod method, String url, Map<String, Object> params, RequestOptions options) static <T extends HasId>
ExpandableField<T>setExpandableFieldId
(String newId, ExpandableField<T> currentObject) When setting a String ID for an ExpandableField, we need to be careful about keeping the String ID and the expanded object in sync.static void
protected static String
singleClassUrl
(Class<?> clazz) protected static String
singleClassUrl
(Class<?> clazz, String apiBase) protected static String
subresourceUrl
(Class<?> clazz, String id, Class<?> subClazz) static String
URL-encodes a string.static String
urlEncodeId
(String id) URL-encode a string ID in url path formatting.Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
Field Details
-
CHARSET
-
GSON
public static final com.google.gson.Gson GSON
-
-
Constructor Details
-
ApiResource
public ApiResource()
-
-
Method Details
-
setStripeResponseGetter
-
singleClassUrl
-
singleClassUrl
-
classUrl
-
classUrl
-
instanceUrl
- Throws:
InvalidRequestException
-
instanceUrl
protected static String instanceUrl(Class<?> clazz, String id, String apiBase) throws InvalidRequestException - Throws:
InvalidRequestException
-
subresourceUrl
protected static String subresourceUrl(Class<?> clazz, String id, Class<?> subClazz) throws InvalidRequestException - Throws:
InvalidRequestException
-
urlEncode
URL-encodes a string. -
urlEncodeId
URL-encode a string ID in url path formatting.- Throws:
InvalidRequestException
-
request
public static <T extends StripeObjectInterface> T request(ApiResource.RequestMethod method, String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) throws StripeException - Throws:
StripeException
-
request
public static <T extends StripeObjectInterface> T request(ApiResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) throws StripeException- Throws:
StripeException
-
requestStream
public static InputStream requestStream(ApiResource.RequestMethod method, String url, ApiRequestParams params, RequestOptions options) throws StripeException - Throws:
StripeException
-
requestStream
public static InputStream requestStream(ApiResource.RequestMethod method, String url, Map<String, Object> params, RequestOptions options) throws StripeException- Throws:
StripeException
-
requestCollection
public static <T extends StripeCollectionInterface<?>> T requestCollection(String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) throws StripeException - Throws:
StripeException
-
requestCollection
public static <T extends StripeCollectionInterface<?>> T requestCollection(String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) throws StripeExceptionSimilar to #request, but specific for use with collection types that come from the API (i.e. lists of resources).Collections need a little extra work because we need to plumb request options and params through so that we can iterate to the next page if necessary.
- Throws:
StripeException
-
requestSearchResult
public static <T extends StripeSearchResultInterface<?>> T requestSearchResult(String url, ApiRequestParams params, Class<T> clazz, RequestOptions options) throws StripeException - Throws:
StripeException
-
requestSearchResult
public static <T extends StripeSearchResultInterface<?>> T requestSearchResult(String url, Map<String, Object> params, Class<T> clazz, RequestOptions options) throws StripeExceptionSimilar to #request, but specific for use with searchResult types that come from the APISearchResults, like collections need a little extra work because we need to plumb request options and params through so that we can iterate to the next page if necessary.
Please note, requestSearchResult is beta functionality and is subject to charge or removal at any time.
- Throws:
StripeException
-
checkNullTypedParams
Invalidate null typed parameters.- Parameters:
url
- request url associated with the given parameters.params
- typed parameters to check for null value.
-
setExpandableFieldId
public static <T extends HasId> ExpandableField<T> setExpandableFieldId(String newId, ExpandableField<T> currentObject) When setting a String ID for an ExpandableField, we need to be careful about keeping the String ID and the expanded object in sync. If they specify a new String ID that is different from the ID within the expanded object, we don't keep the object.
-