--- title: Use the API to respond to disputes subtitle: Learn how to manage disputes programmatically. route: /disputes/api --- # Use the API to respond to disputes Learn how to manage disputes programmatically. You can respond to disputes in the Stripe Dashboard, where we guide you through submitting the optimal evidence for each [dispute reason](https://docs.stripe.com/disputes/categories.md). You can also programmatically manage disputes using the API. With the API, you can upload evidence, respond to disputes, and receive dispute events using webhooks. ## Retrieve a dispute For details about a dispute, [retrieve](https://docs.stripe.com/api.md#retrieve_dispute) a `Dispute` object: ```dotnet StripeConfiguration.ApiKey = "<>"; var service = new DisputeService(); Dispute dispute = service.Get("<>"); ``` ```go stripe.Key = "<>" params := &stripe.DisputeParams{}; result, err := dispute.Get("<>", params); ``` ```java Stripe.apiKey = "<>"; Dispute dispute = Dispute.retrieve("<>"); ``` ```node const stripe = require('stripe')('<>'); const dispute = await stripe.disputes.retrieve('<>'); ``` ```python import stripe stripe.api_key = "<>" dispute = stripe.Dispute.retrieve("<>") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $dispute = $stripe->disputes->retrieve('<>', []); ``` ```ruby Stripe.api_key = '<>' dispute = Stripe::Dispute.retrieve('<>') ``` The response contains information about the dispute and any response or evidence that’s already been provided. ```json { object: "dispute" id: "{{DISPUTE_ID}}", charge: "ch_5Q4BjL06oPWwho", evidence: { customer_name: "Jane Austen", customer_purchase_ip: "127.0.0.1", product_description: "Widget ABC, color: red", shipping_tracking_number: "Z01234567890", uncategorized_text: "Additional notes and comments", }, evidence_details: { due_by: 1403047735, submission_count: 1 } ... } ``` ## Update a dispute You [update](https://docs.stripe.com/api.md#update_dispute) the `Dispute` object and pass structured evidence with the `evidence` parameter. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new DisputeUpdateOptions { Evidence = new DisputeEvidenceOptions { CustomerEmailAddress = "email@example.com", ShippingDate = "2024-02-01", ShippingDocumentation = "<>", }, }; var service = new DisputeService(); Dispute dispute = service.Update("<>", options); ``` ```go stripe.Key = "<>" params := &stripe.DisputeParams{ Evidence: &stripe.DisputeEvidenceParams{ CustomerEmailAddress: stripe.String("email@example.com"), ShippingDate: stripe.String("2024-02-01"), ShippingDocumentation: stripe.String("<>"), }, }; result, err := dispute.Update("<>", params); ``` ```java Stripe.apiKey = "<>"; Dispute resource = Dispute.retrieve("<>"); DisputeUpdateParams params = DisputeUpdateParams.builder() .setEvidence( DisputeUpdateParams.Evidence.builder() .setCustomerEmailAddress("email@example.com") .setShippingDate("2024-02-01") .setShippingDocumentation("<>") .build() ) .build(); Dispute dispute = resource.update(params); ``` ```node const stripe = require('stripe')('<>'); const dispute = await stripe.disputes.update( '<>', { evidence: { customer_email_address: 'email@example.com', shipping_date: '2024-02-01', shipping_documentation: '<>', }, } ); ``` ```python import stripe stripe.api_key = "<>" dispute = stripe.Dispute.modify( "<>", evidence={ "customer_email_address": "email@example.com", "shipping_date": "2024-02-01", "shipping_documentation": "<>", }, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $dispute = $stripe->disputes->update( '<>', [ 'evidence' => [ 'customer_email_address' => 'email@example.com', 'shipping_date' => '2024-02-01', 'shipping_documentation' => '<>', ], ] ); ``` ```ruby Stripe.api_key = '<>' dispute = Stripe::Dispute.update( '<>', { evidence: { customer_email_address: 'email@example.com', shipping_date: '2024-02-01', shipping_documentation: '<>', }, }, ) ``` To view all available fields for the evidence parameter, see [Dispute evidence](https://docs.stripe.com/api.md#dispute_evidence_object). There are two types of evidence you can provide, depending on the field being updated: - Text-based evidence, such as `customer_email` and `service_date`. These types of evidence take a string of text. - File-based evidence, such as `service_documentation` and `customer_communication`. These take a [file_upload](https://docs.stripe.com/api.md#file_object) object ID. The combined character count for all text-based evidence field submissions is limited to 150,000. You can provide documents or images (for example, a contract or screenshot) as part of dispute evidence using the [File Upload API](https://docs.stripe.com/file-upload.md). You first upload a document with the purpose of `dispute_evidence`, which generates a `File_upload` object that you can use when submitting evidence. Make sure the file meets [Stripe’s recommendations](https://docs.stripe.com/disputes/best-practices.md#file-upload-recommendations) before uploading it for evidence submission. If you’re only interested in submitting a single file or a large amount of plaintext as evidence, use `uncategorized_text` or `uncategorized_file`. However, fill in as many fields as possible so you have the best chance at overturning a dispute. ## Multiple disputes on a single payment It’s not typical, but it’s possible for a customer to dispute the same payment more than once. For example, a customer might partially dispute a payment for one of the items in an order if it was damaged in delivery, and then file a second dispute against a different item in the same order because the item didn’t work properly. Stripe distinguishes all disputes by a unique identifier, regardless of whether they’re related to a single payment. When you [list disputes](https://docs.stripe.com/api.md#list_disputes), you can filter the results to show only disputes for a particular payment by specifying the `id` of the `PaymentIntent` or `Charge` object and including the [payment_intent filter](https://docs.stripe.com/api/disputes/list.md#list_disputes-charge) or [charge filter](https://docs.stripe.com/api/disputes/list.md#list_disputes-payment_intent). ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new DisputeListOptions { PaymentIntent = "{{PAYMENT_INTENT_ID}}" }; var service = new DisputeService(); StripeList disputes = service.List(options); ``` ```go stripe.Key = "<>" params := &stripe.DisputeListParams{PaymentIntent: stripe.String("{{PAYMENT_INTENT_ID}}")}; result := dispute.List(params); ``` ```java Stripe.apiKey = "<>"; DisputeListParams params = DisputeListParams.builder().setPaymentIntent("{{PAYMENT_INTENT_ID}}").build(); DisputeCollection disputes = Dispute.list(params); ``` ```node const stripe = require('stripe')('<>'); const disputes = await stripe.disputes.list({ payment_intent: '{{PAYMENT_INTENT_ID}}', }); ``` ```python import stripe stripe.api_key = "<>" disputes = stripe.Dispute.list(payment_intent="{{PAYMENT_INTENT_ID}}") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $disputes = $stripe->disputes->all(['payment_intent' => '{{PAYMENT_INTENT_ID}}']); ``` ```ruby Stripe.api_key = '<>' disputes = Stripe::Dispute.list({payment_intent: '{{PAYMENT_INTENT_ID}}'}) ``` ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new DisputeListOptions { Charge = "{{CHARGE_ID}}" }; var service = new DisputeService(); StripeList disputes = service.List(options); ``` ```go stripe.Key = "<>" params := &stripe.DisputeListParams{Charge: stripe.String("{{CHARGE_ID}}")}; result := dispute.List(params); ``` ```java Stripe.apiKey = "<>"; DisputeListParams params = DisputeListParams.builder().setCharge("{{CHARGE_ID}}").build(); DisputeCollection disputes = Dispute.list(params); ``` ```node const stripe = require('stripe')('<>'); const disputes = await stripe.disputes.list({ charge: '{{CHARGE_ID}}', }); ``` ```python import stripe stripe.api_key = "<>" disputes = stripe.Dispute.list(charge="{{CHARGE_ID}}") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $disputes = $stripe->disputes->all(['charge' => '{{CHARGE_ID}}']); ``` ```ruby Stripe.api_key = '<>' disputes = Stripe::Dispute.list({charge: '{{CHARGE_ID}}'}) ``` When a payment has multiple disputes, use the `id` provided for each returned dispute in the list to make sure you’re responding to the correct dispute by specifying its `id` when you [retrieve](#retrieve-a-dispute) or [update the dispute](#update-a-dispute). ## See Also * [Dispute categories](https://docs.stripe.com/disputes/categories.md) * [Measuring disputes](https://docs.stripe.com/disputes/measuring.md) * [Preventing disputes and fraud](https://docs.stripe.com/disputes/prevention.md)