Class Refund

All Implemented Interfaces:
BalanceTransactionSource, HasId, MetadataStore<Refund>, StripeActiveObject, StripeObjectInterface

public class Refund extends ApiResource implements MetadataStore<Refund>, BalanceTransactionSource
Refund objects allow you to refund a previously created charge that isn't refunded yet. Funds are refunded to the credit or debit card that's initially charged.

Related guide: Refunds

  • Constructor Details

    • Refund

      public Refund()
  • Method Details

    • 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)
    • getCharge

      public String getCharge()
      Get ID of expandable charge object.
    • setCharge

      public void setCharge(String id)
    • getChargeObject

      public Charge getChargeObject()
      Get expanded charge.
    • setChargeObject

      public void setChargeObject(Charge 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)
    • 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)
    • getSourceTransferReversal

      public String getSourceTransferReversal()
      Get ID of expandable sourceTransferReversal object.
    • setSourceTransferReversal

      public void setSourceTransferReversal(String id)
    • getSourceTransferReversalObject

      public TransferReversal getSourceTransferReversalObject()
      Get expanded sourceTransferReversal.
    • setSourceTransferReversalObject

      public void setSourceTransferReversalObject(TransferReversal expandableObject)
    • getTransferReversal

      public String getTransferReversal()
      Get ID of expandable transferReversal object.
    • setTransferReversal

      public void setTransferReversal(String id)
    • getTransferReversalObject

      public TransferReversal getTransferReversalObject()
      Get expanded transferReversal.
    • setTransferReversalObject

      public void setTransferReversalObject(TransferReversal expandableObject)
    • cancel

      public Refund cancel() throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • cancel

      public Refund cancel(RequestOptions options) throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • cancel

      public Refund cancel(Map<String,Object> params) throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • cancel

      public Refund cancel(Map<String,Object> params, RequestOptions options) throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • cancel

      public Refund cancel(RefundCancelParams params) throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • cancel

      public Refund cancel(RefundCancelParams params, RequestOptions options) throws StripeException
      Cancels a refund with a status of requires_action.

      You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action state.

      Throws:
      StripeException
    • create

      public static Refund create(Map<String,Object> params) throws StripeException
      When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.

      Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.

      You can optionally refund only part of a charge. You can do so multiple times, until the entire charge has been refunded.

      Once entirely refunded, a charge can’t be refunded again. This method will raise an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

      Throws:
      StripeException
    • create

      public static Refund create(Map<String,Object> params, RequestOptions options) throws StripeException
      When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.

      Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.

      You can optionally refund only part of a charge. You can do so multiple times, until the entire charge has been refunded.

      Once entirely refunded, a charge can’t be refunded again. This method will raise an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

      Throws:
      StripeException
    • create

      public static Refund create(RefundCreateParams params) throws StripeException
      When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.

      Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.

      You can optionally refund only part of a charge. You can do so multiple times, until the entire charge has been refunded.

      Once entirely refunded, a charge can’t be refunded again. This method will raise an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

      Throws:
      StripeException
    • create

      public static Refund create(RefundCreateParams params, RequestOptions options) throws StripeException
      When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.

      Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.

      You can optionally refund only part of a charge. You can do so multiple times, until the entire charge has been refunded.

      Once entirely refunded, a charge can’t be refunded again. This method will raise an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

      Throws:
      StripeException
    • list

      public static RefundCollection list(Map<String,Object> params) throws StripeException
      Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
      Throws:
      StripeException
    • list

      public static RefundCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
      Throws:
      StripeException
    • list

      public static RefundCollection list(RefundListParams params) throws StripeException
      Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
      Throws:
      StripeException
    • list

      public static RefundCollection list(RefundListParams params, RequestOptions options) throws StripeException
      Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first. The 10 most recent refunds are always available by default on the Charge object.
      Throws:
      StripeException
    • retrieve

      public static Refund retrieve(String refund) throws StripeException
      Retrieves the details of an existing refund.
      Throws:
      StripeException
    • retrieve

      public static Refund retrieve(String refund, RequestOptions options) throws StripeException
      Retrieves the details of an existing refund.
      Throws:
      StripeException
    • retrieve

      public static Refund retrieve(String refund, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the details of an existing refund.
      Throws:
      StripeException
    • retrieve

      public static Refund retrieve(String refund, RefundRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the details of an existing refund.
      Throws:
      StripeException
    • update

      public Refund update(Map<String,Object> params) throws StripeException
      Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.

      This request only accepts metadata as an argument.

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

      public Refund update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.

      This request only accepts metadata as an argument.

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

      public Refund update(RefundUpdateParams params) throws StripeException
      Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.

      This request only accepts metadata as an argument.

      Throws:
      StripeException
    • update

      public Refund update(RefundUpdateParams params, RequestOptions options) throws StripeException
      Updates the refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.

      This request only accepts metadata as an argument.

      Throws:
      StripeException
    • getTestHelpers

      public Refund.TestHelpers getTestHelpers()
      The recipient's email address.
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Description copied from interface: StripeActiveObject
      Method is used by the containing object or StripeResponseGetter implementations to set the StripeResponseGetter instance used to make further requests.
      Specified by:
      setResponseGetter in interface StripeActiveObject
      Overrides:
      setResponseGetter in class ApiResource
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • getAmount

      public Long getAmount()
      Amount, in cents (or local equivalent).
    • 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. You can use this for displaying to users (available on non-card refunds only).
    • getDestinationDetails

      public Refund.DestinationDetails getDestinationDetails()
    • getFailureReason

      public String getFailureReason()
      Provides the reason for the refund failure. Possible values are: lost_or_stolen_card, expired_or_canceled_card, charge_for_pending_refund_disputed, insufficient_funds, declined, merchant_request, or unknown.
    • getInstructionsEmail

      public String getInstructionsEmail()
      For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions.
    • getNextAction

      public Refund.NextAction getNextAction()
    • getObject

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

      Equal to refund.

    • getReason

      public String getReason()
      Reason for the refund, which is either user-provided (duplicate, fraudulent, or requested_by_customer) or generated by Stripe internally ( expired_uncaptured_charge).

      One of duplicate, expired_uncaptured_charge, fraudulent, or requested_by_customer.

    • getReceiptNumber

      public String getReceiptNumber()
      This is the transaction number that appears on email receipts sent for this refund.
    • getStatus

      public String getStatus()
      Status of the refund. This can be pending, requires_action, succeeded, failed, or canceled. Learn more about failed refunds.
    • setAmount

      public void setAmount(Long amount)
      Amount, in cents (or local equivalent).
    • 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. You can use this for displaying to users (available on non-card refunds only).
    • setDestinationDetails

      public void setDestinationDetails(Refund.DestinationDetails destinationDetails)
    • setFailureReason

      public void setFailureReason(String failureReason)
      Provides the reason for the refund failure. Possible values are: lost_or_stolen_card, expired_or_canceled_card, charge_for_pending_refund_disputed, insufficient_funds, declined, merchant_request, or unknown.
    • setId

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

      public void setInstructionsEmail(String instructionsEmail)
      For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions.
    • 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.
    • setNextAction

      public void setNextAction(Refund.NextAction nextAction)
    • setObject

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

      Equal to refund.

    • setReason

      public void setReason(String reason)
      Reason for the refund, which is either user-provided (duplicate, fraudulent, or requested_by_customer) or generated by Stripe internally ( expired_uncaptured_charge).

      One of duplicate, expired_uncaptured_charge, fraudulent, or requested_by_customer.

    • setReceiptNumber

      public void setReceiptNumber(String receiptNumber)
      This is the transaction number that appears on email receipts sent for this refund.
    • setStatus

      public void setStatus(String status)
      Status of the refund. This can be pending, requires_action, succeeded, failed, or canceled. Learn more about failed refunds.
    • 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<Refund>