Disputes Integration Guide

PayPal merchants, partners, and external developers can use the PayPal Disputes API to manage disputes.

For concepts, see the Disputes Overview.

Integration steps

Step Required Stage Description
1. Required Prerequisite Set up your development environment.
2. Optional Gather dispute information You can list disputes and show details for a single dispute.
3. Optional Inquiry You can send message to the other party, make an offer to resolve the dispute, and escalate a dispute to a claim.
4. Optional Claim You can provide evidence, accept the claim, or appeal the dispute if it was resolved in favor of the counter party.
5. Optional Settlement In the sandbox, you can update the dispute status and settle the dispute. See Disputes and Integration Testing.

Set up your development environment

Before you can integrate Disputes, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps.

When you create an app, enable Disputes in the App feature options section.

For details, see Get Started.

Then, return to this page to integrate Disputes.

Gather dispute information

You can gather dispute information during any dispute lifecycle stage. You can list disputes and show details for a single dispute.

List disputes

Merchants can list disputes. When you list disputes, the response shows the dispute_id, reason, status, dispute_amount, create_time, and update_time fields for each dispute.

To filter the disputes in the response, specify one or more optional query parameters in the request URI.

For a full list of query parameters and additional information, see list disputes in the API reference.

Show dispute details

To show details for a dispute, you include the dispute ID in the request URI. The response shows dispute details and HATEOAS links that enable you to complete other actions for the dispute.

Note: The fields that appear in the response depend on whether you access this call through first- or third-party access. For example, if the merchant shows dispute details through third-party access, the customer's email ID does not appear.

For additional information, see show dispute details in the API reference.

Acknowledge returned item

At any stage in the dispute lifecycle, merchants can request that the customer return a MERCHANDISE_OR_SERVICE_NOT_AS_DESCRIBED item or service for a full refund. Until the merchant calls provide evidence to provide PROOF_OF_RETURN, the dispute has the WAITING_FOR_SELLER_RESPONSE status.

For additional information, see acknowledge returned item in the API reference.

Inquiry stage

In the inquiry stage, the dispute status must be INQUIRY.

In this stage, you can send a message to the other party, make an offer to resolve the dispute, and escalate a dispute to a claim.

Currently, you can escalate a dispute to a claim in the sandbox only.

Send message to other party

To send a message to the other party, you include the dispute ID in the request URI.

You must also include a message to the other party in the JSON request body.

A successful request returns the HTTP 200 OK status code and a JSON response body that includes a link to the dispute.

Make offer to resolve dispute

A merchant can make these types of offers to a customer:

Offer type Description
Refund only The merchant agrees to refund a specific amount to the customer.
Refund with return from customer The merchant agrees to refund the full dispute amount but expects the customer to return the item to a specific return address.
Refund with replacement to customer The merchant agrees to refund a specific amount and agrees to send the customer a replacement item.

To make an offer to resolve a dispute, you include the dispute ID in the request URI.

You must also include a note about the offer and the offer amount. You can optionally include a return shipping address for the item and the ID of the invoice for the refund:

note string Required The notes about the offer.
offer_amount object Required The amount proposed to resolve the dispute.
return_shipping_address object Optional The return address for the item.
invoice_id string Optional The ID of the invoice for the refund.

A successful request returns the HTTP 200 OK status code and a JSON response body that includes a link to the dispute.

Escalate dispute to claim

You can escalate a dispute by ID to a PayPal claim to resolve the dispute.

You specify the dispute ID in the URI and include a note about the escalation in the JSON request body:

https://api.sandbox.paypal.com/v1/customer/disputes/PP-000-000-651-454/escalate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -d '{
  "note": "Escalating to PayPal claim for resolution."
}'

A successful request returns the HTTP 200 OK status code and a JSON response body that includes a link to the dispute:

{
  "links": [{
    "rel": "self",
    "method": "GET",
    "href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-000-000-651-454"
  }]
}

Claim stage

In the claim stage, you can provide evidence, accept a claim, and appeal a dispute.

Provide evidence

Customers and merchants can provide evidence for a dispute by ID. Merchants can provide evidence for disputes that have the WAITING_FOR_MERCHANT_RESPONSE status while customers can provide evidence for disputes that have the WAITING_FOR_BUYER_RESPONSE status.

Evidence can be a proof of delivery or proof of refund document or notes, which can include logs. A proof of delivery document includes a tracking number while a proof of refund document includes a refund ID.

Each dispute reason requires certain information for various evidence types. See dispute reasons.

The following rules apply to document file types and sizes:

  • The merchant can upload up to 10 MB of files for a case.
  • Individual files must be smaller than 5 MB.
  • The supported file formats are JPG, GIF, PNG, and PDF.
  • The maximum length of notes is 2000 characters.

To make this request, specify the dispute ID in the URI and specify the evidence in the JSON request body. For information about dispute reasons that are associated with evidence types, see dispute reasons.

The response provides a HATEOAS links that enables you to get more information about the dispute.

For additional information, see provide evidence in the API reference.

Accept claim

When you accept a claim for a dispute, the dispute closes in the customer's favor and you refund the customer's money from your merchant's account.

In addition to specifying the ID of the dispute in the URI, specify one or more optional parameters in the JSON request body:

  • Your notes for acceptance of the customer's claim.
  • Your reason for acceptance of the customer's claim. See dispute reasons.
  • The ID of the invoice for the refund.

For additional information, see accept claim in the API reference.

Appeal dispute

You can appeal a lost dispute by ID.

To appeal a dispute, use the appeal link in the HATEOAS links from the show dispute details response. If this link does not appear, you cannot appeal the dispute.

Specify the dispute ID in the URI, and submit new evidence as a document or notes in the JSON request body. Evidence can be a proof of delivery or proof of refund document or notes, which can include logs. A proof of delivery document includes a tracking number while a proof of refund document includes a refund ID.

The following rules apply to document file types and sizes:

  • The merchant can upload up to 10 MB of files for a case.
  • Individual files must be smaller than 5 MB.
  • The supported file formats are JPG, GIF, PNG, and PDF.

For additional information about dispute reasons, see dispute reasons.

For additional information, see appeal dispute in the API reference.

Sandbox-only methods

In the sandbox, you can use create dispute, update dispute status, or settle dispute. To create a dispute in the sandbox, you must set up buyer-side credentials. To update the dispute status or settle a dispute, you do not need to set up the buyer-side credentials. Refer to API documentation for more information about update dispute status and settle dispute.

Set up buyer-side credentials to create a dispute in the sandbox

To create a dispute in the sandbox, you must set up buyer-side credentials using the following steps.

1. Configure your REST app

Set up your REST app with the following scope:

https://uri.paypal.com/services/disputes/create = DISPUTE_CREATE

2. Get permission from the buyer

To get permission from the buyer to create disputes on their behalf, save the following code as HTML to create a Connect with PayPal button. Set the CLIENT_ID and URL_SET_IN_APP from the REST app. Then, log in as the buyer and accept consent.

<span id='cwppButton'></span>
<script src="https://www.paypalobjects.com/js/external/connect/api.js"></script>
<script>
        paypal.use( ['login'], function (login) {
                login.render ({
                        "appid": "CLIENT_ID",
                        "authend": "sandbox",
                        "scopes": "openid https://uri.paypal.com/services/disputes/create
                        https://uri.paypal.com/services/disputes/read-buyer",
                        "containerid": "cwppButton",
                        "locale": "en-us",
                        "buttonType": "CWP",
                        "buttonSize": "lg",
                        "returnurl": "URL_SET_IN_APP"
                });
          });
</script>

3. Generate access token

Use the following code to generate an access token. Use the CLIENT_ID and secret access token for the merchant to access the PayPal Dispute API.

curl -X POST \ https://api.sandbox.paypal.com/v1/oauth2/token \
-H 'Authorization: Basic <<Your Base64-encoded CLIENT_ID:Secret>>' \
-H 'Content-Type: x-www-form-urlencoded' \
-d grant_type=authorization_code

4. Generate JSON web token for PayPal Authorization Assertion

Use the following code to generate the JSON web token. The CLIENT_ID is from the merchant's REST API. The email is the buyer's email address. The JSON web token is given as output.

<span id='cwppButton'></span>
<html>
<script>
                    function base64url(source) {
                    encodedSource = btoa(source);
                    encodedSource = encodedSource.replace(/=+$/, ");
                    encodedSource = encodedSource.replace(/\+/g, '-');
                    encodedSource = encodedSource.replace(/\//g, '-');

                    return encodedSource;
            }
            function generateJWT() {
                    var header = {"alg": "none", "typ": "JWT"};
                    var data = {"iss"   :"CLIENT_ID",
                               "email" : "BUYER_EMAIL" };
                    document.write(base64url(JSON.stringify(header)) + "." +
                    base64url(JSON.stringify(data)) + ".");
            }
</script>
<body onload="generateJWT()"/>

5. Get the buyer transaction ID

Using the following code, pass the access token from step 2, the JSON web token from step 3, and the seller transaction ID from the transaction details of the transaction in dispute. This API returns the valid type of disputes that can be created for a given transaction. Also, the buyer transaction ID is returned.

curl -X POST https://api.sandbox.paypal.com/v1/customer/disputes/validate-eligibility \
-H 'Authorization: Bearer <<Access Token>>' \
-H 'Content-Type: application/json' \
-H 'PayPal-Auth-Assertion: <<JWT Token>>' \
-d '{
"encrypted_transaction_id": "<<Seller Transaction ID>>"
}'

6. Create the dispute

Using the following code, pass the access token from step 2, the JSON web token from step 3, and the buyer transaction ID from step 4 to create the dispute.

curl -X POST 'https://api.sandbox.paypal.com/v1/customer/disputes' \
-H 'Authorization: Bearer <<ACCESS TOKEN>>' \
-H 'Content-Type: multiplart/related' \
-H 'PayPal-Auth-Assertion: <<JWT TOKEN>>' \
-F 'input={"disputed_transactions":[{
                  "buyer_transaction_id":"<<BUYER TRANSACTION ID>>"
        }],
        "reason": "MERCHANDISE_OR_SERVICE_NOT_RECEIVED",
        "dispute_amount": {}"currency_code":"USD", "value": "7.50" },
        "extensions": {
                      "merchant_contacted": true,
                      "merchant_contacted_outcome": "NO_RESPONSE",
                      "merchandize_dispute_properties": {
                                  "issue_type": "PRODUCT"
                      }
        }
};
type=application/json'

Negative testing for disputes

You can use simulation to test your disputes. For more information, see Disputes and Integration Testing.

Dispute reasons

Each dispute reason requires certain information for various evidence types:

MERCHANDISE_OR_SERVICE_NOT_RECEIVED

The customer did not receive the merchandise or service.

Evidence type Required
PROOF_OF_FULFILLMENT
  • tracking_number
  • carrier_name
PROOF_OF_REFUND

refund_ids

OTHER

A note or document. For example, a document can be a proof of delivery signature or a proof of receipt copy.

MERCHANDISE_OR_SERVICE_NOT_AS_DESCRIBED

The customer reports that the merchandise or service was not as described.

Evidence type Required
OTHER

A note or document. For example, a document can be a description, item URL, return policy, or a copy of a contract or an affidavit.

PROOF_OF_REFUND

A set of refund_ids.

UNAUTHORISED

The customer did not authorize purchase of the merchandise or service.

Evidence type Required
PROOF_OF_FULFILLMENT
  • tracking_number
  • carrier_name
PROOF_OF_REFUND

The refund ID.

OTHER

A note or document. For example, a document can be a proof of delivery signature or a proof of receipt copy.

CREDIT_NOT_PROCESSED

The credit transaction was not processed for the customer.

Evidence type Required
PROOF_OF_REFUND

The refund ID.

OTHER

A note or document. For example, a document can be a credit due reason.

DUPLICATE_TRANSACTION

The transaction was a duplicate.

Evidence type Required
PROOF_OF_FULFILLMENT

The tracking_number, carrier_name, and duplicate or multiple orders.

PROOF_OF_REFUND

The refund ID.

OTHER

A note or document.

INCORRECT_AMOUNT

The customer was charged an incorrect amount.

Evidence type Required
PROOF_OF_REFUND

The refund ID, for the difference in amount.

OTHER

A note or document. For example, a document can be a price difference reason.

PAYMENT_BY_OTHER_MEANS

The customer paid for the transaction through other means.

Evidence type Required
PROOF_OF_REFUND

The refund ID, for the difference in amount.

OTHER

A note or document.

CANCELED_RECURRING_BILLING

The customer was incorrectly charged because he or she canceled recurring billing.

Evidence type Required
PROOF_OF_REFUND

The refund ID, for the difference in amount.

OTHER

A note or document. For example, a document can be a subscription agreement.

OTHER

Evidence type Required
PROOF_OF_SHIPMENT
  • tracking_number
  • carrier_name
PROOF_OF_REFUND

The refund ID.

OTHER

A note or document.

Documents

The merchant can upload up to 10 MB of files for a case:

  1. Individual files must be smaller than 5 MB.
  2. The supported file formats are JPG, GIF, PNG, and PDF.
  3. To make this request, specify the dispute ID in the URI and specify the evidence in the JSON request body.
  4. The length of the text for notes cannot be more than 2000 characters.

Additional information