All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.PaymentSourceCollection Maven / Gradle / Ivy

There is a newer version: 28.2.0
Show newest version
// File generated from our OpenAPI spec
package com.stripe.model;

import com.stripe.exception.StripeException;
import com.stripe.net.ApiMode;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.param.PaymentSourceCollectionCreateParams;
import com.stripe.param.PaymentSourceCollectionListParams;
import com.stripe.param.PaymentSourceCollectionRetrieveParams;
import java.util.Map;

public class PaymentSourceCollection extends StripeCollection {
  /**
   * When you create a new credit card, you must specify a customer or recipient on which to create
   * it.
   *
   * 

If the card’s owner has no default card, then the new card will become the default. However, * if the owner already has a default, then it will not change. To change the default, you should * update the customer to have a new * {@code default_source}. */ public PaymentSource create(Map params) throws StripeException { return create(params, (RequestOptions) null); } /** * When you create a new credit card, you must specify a customer or recipient on which to create * it. * *

If the card’s owner has no default card, then the new card will become the default. However, * if the owner already has a default, then it will not change. To change the default, you should * update the customer to have a new * {@code default_source}. */ public PaymentSource create(Map params, RequestOptions options) throws StripeException { String path = this.getUrl(); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options, ApiMode.V1); return getResponseGetter().request(request, PaymentSource.class); } /** * When you create a new credit card, you must specify a customer or recipient on which to create * it. * *

If the card’s owner has no default card, then the new card will become the default. However, * if the owner already has a default, then it will not change. To change the default, you should * update the customer to have a new * {@code default_source}. */ public PaymentSource create(PaymentSourceCollectionCreateParams params) throws StripeException { return create(params, (RequestOptions) null); } /** * When you create a new credit card, you must specify a customer or recipient on which to create * it. * *

If the card’s owner has no default card, then the new card will become the default. However, * if the owner already has a default, then it will not change. To change the default, you should * update the customer to have a new * {@code default_source}. */ public PaymentSource create(PaymentSourceCollectionCreateParams params, RequestOptions options) throws StripeException { String path = this.getUrl(); ApiResource.checkNullTypedParams(path, params); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.POST, path, ApiRequestParams.paramsToMap(params), options, ApiMode.V1); return getResponseGetter().request(request, PaymentSource.class); } /** List sources for a specified customer. */ public PaymentSourceCollection list(Map params) throws StripeException { return list(params, (RequestOptions) null); } /** List sources for a specified customer. */ public PaymentSourceCollection list(Map params, RequestOptions options) throws StripeException { String path = this.getUrl(); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1); return getResponseGetter().request(request, PaymentSourceCollection.class); } /** List sources for a specified customer. */ public PaymentSourceCollection list(PaymentSourceCollectionListParams params) throws StripeException { return list(params, (RequestOptions) null); } /** List sources for a specified customer. */ public PaymentSourceCollection list( PaymentSourceCollectionListParams params, RequestOptions options) throws StripeException { String path = this.getUrl(); ApiResource.checkNullTypedParams(path, params); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.GET, path, ApiRequestParams.paramsToMap(params), options, ApiMode.V1); return getResponseGetter().request(request, PaymentSourceCollection.class); } /** Retrieve a specified source for a given customer. */ public PaymentSource retrieve(String id) throws StripeException { return retrieve(id, (Map) null, (RequestOptions) null); } /** Retrieve a specified source for a given customer. */ public PaymentSource retrieve(String id, RequestOptions options) throws StripeException { return retrieve(id, (Map) null, options); } /** Retrieve a specified source for a given customer. */ public PaymentSource retrieve(String id, Map params, RequestOptions options) throws StripeException { String path = String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id)); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1); return getResponseGetter().request(request, PaymentSource.class); } /** Retrieve a specified source for a given customer. */ public PaymentSource retrieve( String id, PaymentSourceCollectionRetrieveParams params, RequestOptions options) throws StripeException { String path = String.format("%s/%s", this.getUrl(), ApiResource.urlEncodeId(id)); ApiResource.checkNullTypedParams(path, params); ApiRequest request = new ApiRequest( BaseAddress.API, ApiResource.RequestMethod.GET, path, ApiRequestParams.paramsToMap(params), options, ApiMode.V1); return getResponseGetter().request(request, PaymentSource.class); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy