Create a refund

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 throw an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

Parameters

  • amountinteger

    A positive integer in the smallest currency unit representing how much of this charge to refund. Can refund only up to the remaining, unrefunded amount of the charge.

  • chargestring

    The identifier of the charge to refund.

  • metadataDictionary

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • payment_intentstring

    The identifier of the PaymentIntent to refund.

  • reasonstring

    String indicating the reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer. If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists, and will also help us improve our fraud detection algorithms.

More parameters

  • instructions_emailstring

  • refund_application_feebooleanConnect only

  • reverse_transferbooleanConnect only

Returns

Returns the Refund object if the refund succeeded. Throws an error if the Charge/PaymentIntent has already been refunded, or if an invalid identifier was provided.

POST /v1/refunds
StripeConfiguration.ApiKey = "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new RefundCreateOptions { Charge = "ch_1NirD82eZvKYlo2CIvbtLWuY" };
var service = new RefundService();
service.Create(options);
Response
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"destination_details": {
"card": {
"reference": "123456789012",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}

Update a refund

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.

Parameters

  • metadataDictionary

    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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Returns

Returns the refund object if the update succeeds. This call throws an error if update parameters are invalid.

POST /v1/refunds/:id
StripeConfiguration.ApiKey = "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new RefundUpdateOptions
{
Metadata = new Dictionary<string, string> { { "order_id", "6735" } },
};
var service = new RefundService();
service.Update("re_1Nispe2eZvKYlo2Cd31jOCgZ", options);
Response
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"destination_details": {
"card": {
"reference": "123456789012",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {
"order_id": "6735"
},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}

Retrieve a refund

Retrieves the details of an existing refund.

Parameters

No parameters.

Returns

Returns a refund if you provide a valid ID. Throws an error otherwise.

GET /v1/refunds/:id
StripeConfiguration.ApiKey = "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new RefundService();
service.Get("re_1Nispe2eZvKYlo2Cd31jOCgZ");
Response
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"destination_details": {
"card": {
"reference": "123456789012",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}

List all refunds

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.

Parameters

  • chargestring

    Only return refunds for the charge specified by this charge ID.

  • payment_intentstring

    Only return refunds for the PaymentIntent specified by this ID.

More parameters

  • createdDictionary

  • ending_beforestring

  • limitinteger

  • starting_afterstring

Returns

A Dictionary with a data property that contains an array of up to limit refunds, starting after the starting_after refund. Each entry in the array is a separate Refund object. If no other refunds are available, the resulting array is empty. If you provide a non-existent charge ID, this call throws an error.

GET /v1/refunds
StripeConfiguration.ApiKey = "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc";
var options = new RefundListOptions { Limit = 3 };
var service = new RefundService();
StripeList<Refund> refunds = service.List(options);
Response
{
"object": "list",
"url": "/v1/refunds",
"has_more": false,
"data": [
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"destination_details": {
"card": {
"reference": "123456789012",
"reference_status": "available",
"reference_type": "acquirer_reference_number",
"type": "refund"
},
"type": "card"
},
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
{...}
{...}
],
}

Cancel a refund

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.

Parameters

No parameters.

Returns

Returns the refund object if the cancellation succeeds. This call throws an error if you can’t cancel the refund.

POST /v1/refunds/:id/cancel
StripeConfiguration.ApiKey = "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new RefundService();
service.Cancel("re_1Nispe2eZvKYlo2Cd31jOCgZ");
Response
{
"id": "re_1Nispe2eZvKYlo2Cd31jOCgZ",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1Nispe2eZvKYlo2CYezqFhEx",
"charge": "ch_1NirD82eZvKYlo2CIvbtLWuY",
"created": 1692942318,
"currency": "usd",
"metadata": {},
"payment_intent": "pi_1GszsK2eZvKYlo2CfhZyoZLp",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Log in to your Stripe account and press Control + Backtick (`) on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g., )
The Stripe Shell is best experienced on desktop.
$