Class Source

All Implemented Interfaces:
HasId, MetadataStore<Source>, PaymentSource, StripeObjectInterface

public class Source extends ApiResource implements MetadataStore<Source>, PaymentSource
Source objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Stripe API just like a Card object: once chargeable, they can be charged, or can be attached to customers.

Related guides: Sources API and Sources & Customers.

  • Constructor Details

    • Source

      public Source()
  • Method Details

    • create

      public static Source create(Map<String,Object> params) throws StripeException
      Creates a new source object.
      Throws:
      StripeException
    • create

      public static Source create(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a new source object.
      Throws:
      StripeException
    • create

      public static Source create(SourceCreateParams params) throws StripeException
      Creates a new source object.
      Throws:
      StripeException
    • create

      public static Source create(SourceCreateParams params, RequestOptions options) throws StripeException
      Creates a new source object.
      Throws:
      StripeException
    • detach

      public Source detach() throws StripeException
      Delete a specified source for a given customer.
      Throws:
      StripeException
    • detach

      public Source detach(Map<String,Object> params) throws StripeException
      Delete a specified source for a given customer.
      Throws:
      StripeException
    • detach

      public Source detach(Map<String,Object> params, RequestOptions options) throws StripeException
      Delete a specified source for a given customer.
      Throws:
      StripeException
    • detach

      public Source detach(SourceDetachParams params) throws StripeException
      Delete a specified source for a given customer.
      Throws:
      StripeException
    • detach

      public Source detach(SourceDetachParams params, RequestOptions options) throws StripeException
      Delete a specified source for a given customer.
      Throws:
      StripeException
    • retrieve

      public static Source retrieve(String source) throws StripeException
      Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
      Throws:
      StripeException
    • retrieve

      public static Source retrieve(String source, RequestOptions options) throws StripeException
      Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
      Throws:
      StripeException
    • retrieve

      public static Source retrieve(String source, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
      Throws:
      StripeException
    • retrieve

      public static Source retrieve(String source, SourceRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
      Throws:
      StripeException
    • sourceTransactions

      public SourceTransactionCollection sourceTransactions() throws StripeException
      List source transactions for a given source.
      Throws:
      StripeException
    • sourceTransactions

      public SourceTransactionCollection sourceTransactions(Map<String,Object> params) throws StripeException
      List source transactions for a given source.
      Throws:
      StripeException
    • sourceTransactions

      public SourceTransactionCollection sourceTransactions(Map<String,Object> params, RequestOptions options) throws StripeException
      List source transactions for a given source.
      Throws:
      StripeException
    • sourceTransactions

      List source transactions for a given source.
      Throws:
      StripeException
    • sourceTransactions

      List source transactions for a given source.
      Throws:
      StripeException
    • update

      public Source update(Map<String,Object> params) throws StripeException
      Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

      This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.

      Specified by:
      update in interface MetadataStore<Source>
      Throws:
      StripeException
    • update

      public Source update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

      This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.

      Specified by:
      update in interface MetadataStore<Source>
      Throws:
      StripeException
    • update

      public Source update(SourceUpdateParams params) throws StripeException
      Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

      This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.

      Throws:
      StripeException
    • update

      public Source update(SourceUpdateParams params, RequestOptions options) throws StripeException
      Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

      This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.

      Throws:
      StripeException
    • verify

      public Source verify(Map<String,Object> params) throws StripeException
      Verify a given source.
      Throws:
      StripeException
    • verify

      public Source verify(Map<String,Object> params, RequestOptions options) throws StripeException
      Verify a given source.
      Throws:
      StripeException
    • verify

      public Source verify(SourceVerifyParams params) throws StripeException
      Verify a given source.
      Throws:
      StripeException
    • verify

      public Source verify(SourceVerifyParams params, RequestOptions options) throws StripeException
      Verify a given source.
      Throws:
      StripeException
    • getAchCreditTransfer

      public Source.AchCreditTransfer getAchCreditTransfer()
    • getAchDebit

      public Source.AchDebit getAchDebit()
    • getAcssDebit

      public Source.AcssDebit getAcssDebit()
    • getAlipay

      public Source.Alipay getAlipay()
    • getAmount

      public Long getAmount()
      A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources.
    • getAuBecsDebit

      public Source.AuBecsDebit getAuBecsDebit()
    • getBancontact

      public Source.Bancontact getBancontact()
    • getCard

      public Source.Card getCard()
    • getCardPresent

      public Source.CardPresent getCardPresent()
    • getClientSecret

      public String getClientSecret()
      The client secret of the source. Used for client-side retrieval using a publishable key.
    • getCodeVerification

      public Source.CodeVerificationFlow getCodeVerification()
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getCurrency

      public String getCurrency()
      Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required for single_use sources.
    • getCustomer

      public String getCustomer()
      The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer.
    • getEps

      public Source.Eps getEps()
    • getFlow

      public String getFlow()
      The authentication flow of the source. flow is one of redirect, receiver, code_verification, none.
    • getGiropay

      public Source.Giropay getGiropay()
    • getIdeal

      public Source.Ideal getIdeal()
    • getKlarna

      public Source.Klarna getKlarna()
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getMultibanco

      public Source.Multibanco getMultibanco()
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to source.

    • getOwner

      public Source.Owner getOwner()
      Information about the owner of the payment instrument that may be used or required by particular source types.
    • getP24

      public Source.P24 getP24()
    • getReceiver

      public Source.ReceiverFlow getReceiver()
    • getRedirect

      public Source.RedirectFlow getRedirect()
    • getSepaCreditTransfer

      public Source.SepaCreditTransfer getSepaCreditTransfer()
    • getSepaDebit

      public Source.SepaDebit getSepaDebit()
    • getSofort

      public Source.Sofort getSofort()
    • getSourceOrder

      public Source.Order getSourceOrder()
    • getStatementDescriptor

      public String getStatementDescriptor()
      Extra information about a source. This will appear on your customer's statement every time you charge the source.
    • getStatus

      public String getStatus()
      The status of the source, one of canceled, chargeable, consumed, failed, or pending. Only chargeable sources can be used to create a charge.
    • getThreeDSecure

      public Source.ThreeDSecure getThreeDSecure()
    • getType

      public String getType()
      The type of the source. The type is a payment method, one of ach_credit_transfer, ach_debit, alipay, bancontact, card, card_present, eps, giropay, ideal, multibanco, klarna, p24, sepa_debit, sofort, three_d_secure, or wechat. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used.
    • getUsage

      public String getUsage()
      Either reusable or single_use. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
    • getWechat

      public Source.Wechat getWechat()
    • setAchCreditTransfer

      public void setAchCreditTransfer(Source.AchCreditTransfer achCreditTransfer)
    • setAchDebit

      public void setAchDebit(Source.AchDebit achDebit)
    • setAcssDebit

      public void setAcssDebit(Source.AcssDebit acssDebit)
    • setAlipay

      public void setAlipay(Source.Alipay alipay)
    • setAmount

      public void setAmount(Long amount)
      A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources.
    • setAuBecsDebit

      public void setAuBecsDebit(Source.AuBecsDebit auBecsDebit)
    • setBancontact

      public void setBancontact(Source.Bancontact bancontact)
    • setCard

      public void setCard(Source.Card card)
    • setCardPresent

      public void setCardPresent(Source.CardPresent cardPresent)
    • setClientSecret

      public void setClientSecret(String clientSecret)
      The client secret of the source. Used for client-side retrieval using a publishable key.
    • setCodeVerification

      public void setCodeVerification(Source.CodeVerificationFlow codeVerification)
    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setCurrency

      public void setCurrency(String currency)
      Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required for single_use sources.
    • setCustomer

      public void setCustomer(String customer)
      The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer.
    • setEps

      public void setEps(Source.Eps eps)
    • setFlow

      public void setFlow(String flow)
      The authentication flow of the source. flow is one of redirect, receiver, code_verification, none.
    • setGiropay

      public void setGiropay(Source.Giropay giropay)
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setIdeal

      public void setIdeal(Source.Ideal ideal)
    • setKlarna

      public void setKlarna(Source.Klarna klarna)
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setMultibanco

      public void setMultibanco(Source.Multibanco multibanco)
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to source.

    • setOwner

      public void setOwner(Source.Owner owner)
      Information about the owner of the payment instrument that may be used or required by particular source types.
    • setP24

      public void setP24(Source.P24 p24)
    • setReceiver

      public void setReceiver(Source.ReceiverFlow receiver)
    • setRedirect

      public void setRedirect(Source.RedirectFlow redirect)
    • setSepaCreditTransfer

      public void setSepaCreditTransfer(Source.SepaCreditTransfer sepaCreditTransfer)
    • setSepaDebit

      public void setSepaDebit(Source.SepaDebit sepaDebit)
    • setSofort

      public void setSofort(Source.Sofort sofort)
    • setSourceOrder

      public void setSourceOrder(Source.Order sourceOrder)
    • setStatementDescriptor

      public void setStatementDescriptor(String statementDescriptor)
      Extra information about a source. This will appear on your customer's statement every time you charge the source.
    • setStatus

      public void setStatus(String status)
      The status of the source, one of canceled, chargeable, consumed, failed, or pending. Only chargeable sources can be used to create a charge.
    • setThreeDSecure

      public void setThreeDSecure(Source.ThreeDSecure threeDSecure)
    • setType

      public void setType(String type)
      The type of the source. The type is a payment method, one of ach_credit_transfer, ach_debit, alipay, bancontact, card, card_present, eps, giropay, ideal, multibanco, klarna, p24, sepa_debit, sofort, three_d_secure, or wechat. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used.
    • setUsage

      public void setUsage(String usage)
      Either reusable or single_use. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
    • setWechat

      public void setWechat(Source.Wechat wechat)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
      Specified by:
      getMetadata in interface MetadataStore<Source>