Class Charge

All Implemented Interfaces:
BalanceTransactionSource, HasId, MetadataStore<Charge>, StripeObjectInterface

public class Charge extends ApiResource implements MetadataStore<Charge>, BalanceTransactionSource
  • Constructor Details

    • Charge

      public Charge()
  • Method Details

    • getApplication

      public String getApplication()
      Get ID of expandable application object.
    • setApplication

      public void setApplication(String id)
    • getApplicationObject

      public Application getApplicationObject()
      Get expanded application.
    • setApplicationObject

      public void setApplicationObject(Application expandableObject)
    • getApplicationFee

      public String getApplicationFee()
      Get ID of expandable applicationFee object.
    • setApplicationFee

      public void setApplicationFee(String id)
    • getApplicationFeeObject

      public ApplicationFee getApplicationFeeObject()
      Get expanded applicationFee.
    • setApplicationFeeObject

      public void setApplicationFeeObject(ApplicationFee expandableObject)
    • getBalanceTransaction

      public String getBalanceTransaction()
      Get ID of expandable balanceTransaction object.
    • setBalanceTransaction

      public void setBalanceTransaction(String id)
    • getBalanceTransactionObject

      public BalanceTransaction getBalanceTransactionObject()
      Get expanded balanceTransaction.
    • setBalanceTransactionObject

      public void setBalanceTransactionObject(BalanceTransaction expandableObject)
    • getCustomer

      public String getCustomer()
      Get ID of expandable customer object.
    • setCustomer

      public void setCustomer(String id)
    • getCustomerObject

      public Customer getCustomerObject()
      Get expanded customer.
    • setCustomerObject

      public void setCustomerObject(Customer expandableObject)
    • getDestination

      public String getDestination()
      Get ID of expandable destination object.
    • setDestination

      public void setDestination(String id)
    • getDestinationObject

      public Account getDestinationObject()
      Get expanded destination.
    • setDestinationObject

      public void setDestinationObject(Account expandableObject)
    • getDispute

      public String getDispute()
      Get ID of expandable dispute object.
    • setDispute

      public void setDispute(String id)
    • getDisputeObject

      public Dispute getDisputeObject()
      Get expanded dispute.
    • setDisputeObject

      public void setDisputeObject(Dispute expandableObject)
    • getFailureBalanceTransaction

      public String getFailureBalanceTransaction()
      Get ID of expandable failureBalanceTransaction object.
    • setFailureBalanceTransaction

      public void setFailureBalanceTransaction(String id)
    • getFailureBalanceTransactionObject

      public BalanceTransaction getFailureBalanceTransactionObject()
      Get expanded failureBalanceTransaction.
    • setFailureBalanceTransactionObject

      public void setFailureBalanceTransactionObject(BalanceTransaction expandableObject)
    • getInvoice

      public String getInvoice()
      Get ID of expandable invoice object.
    • setInvoice

      public void setInvoice(String id)
    • getInvoiceObject

      public Invoice getInvoiceObject()
      Get expanded invoice.
    • setInvoiceObject

      public void setInvoiceObject(Invoice expandableObject)
    • getOnBehalfOf

      public String getOnBehalfOf()
      Get ID of expandable onBehalfOf object.
    • setOnBehalfOf

      public void setOnBehalfOf(String id)
    • getOnBehalfOfObject

      public Account getOnBehalfOfObject()
      Get expanded onBehalfOf.
    • setOnBehalfOfObject

      public void setOnBehalfOfObject(Account expandableObject)
    • getPaymentIntent

      public String getPaymentIntent()
      Get ID of expandable paymentIntent object.
    • setPaymentIntent

      public void setPaymentIntent(String id)
    • getPaymentIntentObject

      public PaymentIntent getPaymentIntentObject()
      Get expanded paymentIntent.
    • setPaymentIntentObject

      public void setPaymentIntentObject(PaymentIntent expandableObject)
    • getReview

      public String getReview()
      Get ID of expandable review object.
    • setReview

      public void setReview(String id)
    • getReviewObject

      public Review getReviewObject()
      Get expanded review.
    • setReviewObject

      public void setReviewObject(Review expandableObject)
    • getSourceTransfer

      public String getSourceTransfer()
      Get ID of expandable sourceTransfer object.
    • setSourceTransfer

      public void setSourceTransfer(String id)
    • getSourceTransferObject

      public Transfer getSourceTransferObject()
      Get expanded sourceTransfer.
    • setSourceTransferObject

      public void setSourceTransferObject(Transfer expandableObject)
    • getTransfer

      public String getTransfer()
      Get ID of expandable transfer object.
    • setTransfer

      public void setTransfer(String id)
    • getTransferObject

      public Transfer getTransferObject()
      Get expanded transfer.
    • setTransferObject

      public void setTransferObject(Transfer expandableObject)
    • getOrder

      public String getOrder()
      Get ID of expandable order object.
    • setOrder

      public void setOrder(String id)
    • getOrderObject

      public Order getOrderObject()
      Get expanded order.
    • setOrderObject

      public void setOrderObject(Order expandableObject)
    • search

      public static ChargeSearchResult search(Map<String,Object> params) throws StripeException
      Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
      Throws:
      StripeException
    • search

      public static ChargeSearchResult search(Map<String,Object> params, RequestOptions options) throws StripeException
      Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
      Throws:
      StripeException
    • search

      public static ChargeSearchResult search(ChargeSearchParams params) throws StripeException
      Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
      Throws:
      StripeException
    • search

      public static ChargeSearchResult search(ChargeSearchParams params, RequestOptions options) throws StripeException
      Search for charges you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
      Throws:
      StripeException
    • list

      public static ChargeCollection list(Map<String,Object> params) throws StripeException
      Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
      Throws:
      StripeException
    • list

      public static ChargeCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
      Throws:
      StripeException
    • list

      public static ChargeCollection list(ChargeListParams params) throws StripeException
      Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
      Throws:
      StripeException
    • list

      public static ChargeCollection list(ChargeListParams params, RequestOptions options) throws StripeException
      Returns a list of charges you’ve previously created. The charges are returned in sorted order, with the most recent charges appearing first.
      Throws:
      StripeException
    • create

      public static Charge create(Map<String,Object> params) throws StripeException
      To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).
      Throws:
      StripeException
    • create

      public static Charge create(Map<String,Object> params, RequestOptions options) throws StripeException
      To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).
      Throws:
      StripeException
    • create

      public static Charge create(ChargeCreateParams params) throws StripeException
      To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).
      Throws:
      StripeException
    • create

      public static Charge create(ChargeCreateParams params, RequestOptions options) throws StripeException
      To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won’t actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).
      Throws:
      StripeException
    • retrieve

      public static Charge retrieve(String charge) throws StripeException
      Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge.
      Throws:
      StripeException
    • retrieve

      public static Charge retrieve(String charge, RequestOptions options) throws StripeException
      Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge.
      Throws:
      StripeException
    • retrieve

      public static Charge retrieve(String charge, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge.
      Throws:
      StripeException
    • retrieve

      public static Charge retrieve(String charge, ChargeRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge.
      Throws:
      StripeException
    • update

      public Charge update(Map<String,Object> params) throws StripeException
      Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Specified by:
      update in interface MetadataStore<Charge>
      Throws:
      StripeException
    • update

      public Charge update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Specified by:
      update in interface MetadataStore<Charge>
      Throws:
      StripeException
    • update

      public Charge update(ChargeUpdateParams params) throws StripeException
      Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • update

      public Charge update(ChargeUpdateParams params, RequestOptions options) throws StripeException
      Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • capture

      public Charge capture() throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • capture

      public Charge capture(RequestOptions options) throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • capture

      public Charge capture(Map<String,Object> params) throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • capture

      public Charge capture(Map<String,Object> params, RequestOptions options) throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • capture

      public Charge capture(ChargeCaptureParams params) throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • capture

      public Charge capture(ChargeCaptureParams params, RequestOptions options) throws StripeException
      Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created a charge with the capture option set to false.

      Uncaptured payments expire a set number of days after they are created (7 by default). If they are not captured by that point in time, they will be marked as refunded and will no longer be capturable.

      Throws:
      StripeException
    • getAlternateStatementDescriptors

      public Charge.AlternateStatementDescriptors getAlternateStatementDescriptors()
    • getAmount

      public Long getAmount()
      Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
    • getAmountCaptured

      public Long getAmountCaptured()
      Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made).
    • getAmountRefunded

      public Long getAmountRefunded()
      Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued).
    • getApplicationFeeAmount

      public Long getApplicationFeeAmount()
      The amount of the application fee (if any) requested for the charge. See the Connect documentation for details.
    • getAuthorizationCode

      public String getAuthorizationCode()
      Authorization code on the charge.
    • getBillingDetails

      public PaymentMethod.BillingDetails getBillingDetails()
    • getCalculatedStatementDescriptor

      public String getCalculatedStatementDescriptor()
      The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
    • getCaptured

      public Boolean getCaptured()
      If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured.
    • 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 currency code, in lowercase. Must be a supported currency.
    • getDescription

      public String getDescription()
      An arbitrary string attached to the object. Often useful for displaying to users.
    • getDisputed

      public Boolean getDisputed()
      Whether the charge has been disputed.
    • getFailureCode

      public String getFailureCode()
      Error code explaining reason for charge failure if available (see the errors section for a list of codes).
    • getFailureMessage

      public String getFailureMessage()
      Message to user further explaining reason for charge failure if available.
    • getFraudDetails

      public Charge.FraudDetails getFraudDetails()
      Information on fraud assessments for the charge.
    • getLevel3

      public Charge.Level3 getLevel3()
    • 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.
    • getObject

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

      Equal to charge.

    • getOutcome

      public Charge.Outcome getOutcome()
      Details about whether the payment was accepted, and why. See understanding declines for details.
    • getPaid

      public Boolean getPaid()
      true if the charge succeeded, or was successfully authorized for later capture.
    • getPaymentMethod

      public String getPaymentMethod()
      ID of the payment method used in this charge.
    • getPaymentMethodDetails

      public Charge.PaymentMethodDetails getPaymentMethodDetails()
      Details about the payment method at the time of the transaction.
    • getReceiptEmail

      public String getReceiptEmail()
      This is the email address that the receipt for this charge was sent to.
    • getReceiptNumber

      public String getReceiptNumber()
      This is the transaction number that appears on email receipts sent for this charge. This attribute will be null until a receipt has been sent.
    • getReceiptUrl

      public String getReceiptUrl()
      This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt.
    • getRefunded

      public Boolean getRefunded()
      Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
    • getRefunds

      public RefundCollection getRefunds()
      A list of refunds that have been applied to the charge.
    • getShipping

      public ShippingDetails getShipping()
      Shipping information for the charge.
    • getSource

      public PaymentSource getSource()
      This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to payment_method or payment_method_details instead.
    • getStatementDescriptor

      public String getStatementDescriptor()
      For card charges, use statement_descriptor_suffix instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.
    • getStatementDescriptorSuffix

      public String getStatementDescriptorSuffix()
      Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
    • getStatus

      public String getStatus()
      The status of the payment is either succeeded, pending, or failed.

      One of failed, pending, or succeeded.

    • getTransferData

      public Charge.TransferData getTransferData()
      An optional dictionary including the account to automatically transfer to as part of a destination charge. See the Connect documentation for details.
    • getTransferGroup

      public String getTransferGroup()
      A string that identifies this transaction as part of a group. See the Connect documentation for details.
    • setAlternateStatementDescriptors

      public void setAlternateStatementDescriptors(Charge.AlternateStatementDescriptors alternateStatementDescriptors)
    • setAmount

      public void setAmount(Long amount)
      Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
    • setAmountCaptured

      public void setAmountCaptured(Long amountCaptured)
      Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made).
    • setAmountRefunded

      public void setAmountRefunded(Long amountRefunded)
      Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued).
    • setApplicationFeeAmount

      public void setApplicationFeeAmount(Long applicationFeeAmount)
      The amount of the application fee (if any) requested for the charge. See the Connect documentation for details.
    • setAuthorizationCode

      public void setAuthorizationCode(String authorizationCode)
      Authorization code on the charge.
    • setBillingDetails

      public void setBillingDetails(PaymentMethod.BillingDetails billingDetails)
    • setCalculatedStatementDescriptor

      public void setCalculatedStatementDescriptor(String calculatedStatementDescriptor)
      The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined.
    • setCaptured

      public void setCaptured(Boolean captured)
      If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured.
    • 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 currency code, in lowercase. Must be a supported currency.
    • setDescription

      public void setDescription(String description)
      An arbitrary string attached to the object. Often useful for displaying to users.
    • setDisputed

      public void setDisputed(Boolean disputed)
      Whether the charge has been disputed.
    • setFailureCode

      public void setFailureCode(String failureCode)
      Error code explaining reason for charge failure if available (see the errors section for a list of codes).
    • setFailureMessage

      public void setFailureMessage(String failureMessage)
      Message to user further explaining reason for charge failure if available.
    • setFraudDetails

      public void setFraudDetails(Charge.FraudDetails fraudDetails)
      Information on fraud assessments for the charge.
    • setId

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

      public void setLevel3(Charge.Level3 level3)
    • 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.
    • setObject

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

      Equal to charge.

    • setOutcome

      public void setOutcome(Charge.Outcome outcome)
      Details about whether the payment was accepted, and why. See understanding declines for details.
    • setPaid

      public void setPaid(Boolean paid)
      true if the charge succeeded, or was successfully authorized for later capture.
    • setPaymentMethod

      public void setPaymentMethod(String paymentMethod)
      ID of the payment method used in this charge.
    • setPaymentMethodDetails

      public void setPaymentMethodDetails(Charge.PaymentMethodDetails paymentMethodDetails)
      Details about the payment method at the time of the transaction.
    • setReceiptEmail

      public void setReceiptEmail(String receiptEmail)
      This is the email address that the receipt for this charge was sent to.
    • setReceiptNumber

      public void setReceiptNumber(String receiptNumber)
      This is the transaction number that appears on email receipts sent for this charge. This attribute will be null until a receipt has been sent.
    • setReceiptUrl

      public void setReceiptUrl(String receiptUrl)
      This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt.
    • setRefunded

      public void setRefunded(Boolean refunded)
      Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
    • setRefunds

      public void setRefunds(RefundCollection refunds)
      A list of refunds that have been applied to the charge.
    • setShipping

      public void setShipping(ShippingDetails shipping)
      Shipping information for the charge.
    • setSource

      public void setSource(PaymentSource source)
      This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to payment_method or payment_method_details instead.
    • setStatementDescriptor

      public void setStatementDescriptor(String statementDescriptor)
      For card charges, use statement_descriptor_suffix instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters.
    • setStatementDescriptorSuffix

      public void setStatementDescriptorSuffix(String statementDescriptorSuffix)
      Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
    • setStatus

      public void setStatus(String status)
      The status of the payment is either succeeded, pending, or failed.

      One of failed, pending, or succeeded.

    • setTransferData

      public void setTransferData(Charge.TransferData transferData)
      An optional dictionary including the account to automatically transfer to as part of a destination charge. See the Connect documentation for details.
    • setTransferGroup

      public void setTransferGroup(String transferGroup)
      A string that identifies this transaction as part of a group. See the Connect documentation for details.
    • 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<Charge>