# Send Payment dispute processing tutorial
source: https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/send-tutorial/index.md

## Overview {#overview}

This tutorial will show you the process of how Originating Institutions and Receiving Institutions manage Send Payment disputes.

#### What you will learn {#what-you-will-learn}

> * How to create a Send Payment dispute
> * How to respond to a posting status Send Payment dispute
> * How to respond to a Send Payment dispute

## Before you start {#before-you-start}

Before starting this tutorial, ensure that you have already completed the following:

* [Mastercom Extended API Client Generation Tutorial](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/clientgeneration-tutorial/index.md)
* [Quick Start Guide](https://developer.mastercard.com/mastercom-extended/documentation/quick-start-guide/index.md)

## Step 1: Search for transactions {#step-1-search-for-transactions}

The Originating Institution searches for transactions. Send transactions are identified in the `transactionClass` field.
Note: The transaction search response will contain any claims in Mastercom Extended already associated with the transaction.
API Reference: `POST /transactions/searches`

**Refer to [Step 1](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/seachtrans-tutorial/index.md) of the [Transactions](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/seachtrans-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 2: Create a claim {#step-2-create-a-claim}

The Originating Institution creates a claim for the selected transaction.

API Reference: `POST /claims`

**Refer to [Step 1](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) of the [Claims](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 3: Retrieve the claim details from an existing claim {#step-3-retrieve-the-claim-details-from-an-existing-claim}

The Originating Institution retrieves the claim details from an existing claim.

API Reference: `GET /claims/{claim_id}`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) of the [Claims](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 4: Upload documents {#step-4-upload-documents}

The Originating Institution uploads documents.

API Reference: `POST /documents`

**Refer to [Step 1](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 5: Create a Send Payment dispute {#step-5-create-a-send-payment-dispute}

Originating Institutions use this endpoint to create a Send Payment dispute.

API Reference: `POST /send-payments/claims/{claim_id}/disputes`

To initiate a Send Payment dispute, create a `SendPaymentsApi` object. Then use method `sendPaymentsApi.createSendPaymentDispute` to raise the dispute.

This method expects the `claimId` and request body to be provided. The request body is an instantiation of the `InitiateSendPaymentDispute` object.

```java
  public class Main {
    public static void main(String[] args) {
      // API client set up here...    
      
      SendPaymentsApi sendPaymentsApi = new SendPaymentsApi(client);
  
      InitiateSendPaymentDispute body = new InitiateSendPaymentDispute();
      body.setSendDisputeReasonCode(InitiateSendPaymentDispute.SendDisputeReasonCodeEnum.B_FRAUD);
      body.setSendDisputeFraudSubReasonCode(InitiateSendPaymentDispute.SendDisputeFraudSubReasonCodeEnum.I_IMPERSONATION_SCAM);
      body.setDocumentUploadedId("e59c3a2a9f4311ee8855eeee0afc63f1");
      body.setDocumentMemo("Cardholder letter.");
      body.setMemo("Send Payment dispute information.");
      
      try{
        SendPaymentDisputeCreateEvent result = sendPaymentsApi.createSendPaymentDispute(claimId, body);
        System.out.println(result);
      } catch (ApiException e){
        System.err.println("Exception when calling SendPaymentsApi#InitiateSendPaymentDispute");
        System.err.println("Status code: " + e.getCode());
        System.err.println("Reason: " + e.getResponseBody());
        System.err.println("Response headers: " + e.getResponseHeaders());
        e.printStackTrace();
      }
    }
  }
```

#### Review the possible error codes associated with this request {#review-the-possible-error-codes-associated-with-this-request}

| HTTP Code |          Error Code          |                                              Description                                              |
|-----------|------------------------------|-------------------------------------------------------------------------------------------------------|
| 400       | BAD_REQUEST                  | Bad request                                                                                           |
| 400       | INVALID_INPUT_LENGTH         | Invalid input length for field `memo`                                                                 |
| 400       | SEND_INIT_DISPUTE_SUB_REASON | The `sendDisputeFraudSubReasonCode` field can be used only when `sendDisputeReasonCode` is `B_FRAUD`. |
| 400       | INVALID_INPUT_VALUE          | Invalid input value for field `sendDisputeFraudSubReasonCode`                                         |
| 400       | MISSING_REQUIRED_INPUT       | Missing required field `sendDisputeFraudSubReasonCode`                                                |
| 400       | MISSING_REQUIRED_INPUT       | Missing required field `memo`                                                                         |
| 401       | NOT_AUTHORIZED_REQUEST       | Unauthorized                                                                                          |
| 403       | FORBIDDEN                    | Forbidden                                                                                             |
| 404       | RESOURCE_UNKNOWN             | Resource not found                                                                                    |

#### Verify response {#verify-response}

You should receive a 201 OK response. Returns the `eventId`.

## Step 6: Retrieve the document processing details {#step-6-retrieve-the-document-processing-details}

The Originating Institution retrieves the document processing details of the uploaded documentation.

API Reference: `GET /documents/attributes`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 7: Retrieve list of claims in a queue {#step-7-retrieve-list-of-claims-in-a-queue}

The Receiving Institution uses this endpoint to retrieve claims from the Send Payment Receiving Institution Unworked queue.

API Reference: `GET /queues/{queue_id}/claims`

**Refer to [Step 4](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/queues-tutorial/index.md) of the [Queues](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/queues-tutorial/index.md) tutorial for more specific information on how to utilize this endpoint.**

## Step 8: Retrieve the claim details for an existing claim {#step-8-retrieve-the-claim-details-for-an-existing-claim}

The Receiving Institution retrieves the claim details for an existing claim.

API Reference: `GET /claims/{claim_id}`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) of the [Claims](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 9: Upload documents {#step-9-upload-documents}

The Receiving Institution uploads documents if required by the response action.

API Reference: `POST /documents`

**Refer to [Step 1](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 10: Respond to a posting status Send Payment dispute {#step-10-respond-to-a-posting-status-send-payment-dispute}

Receiving Institutions use this endpoint to respond to a posting status Send payment dispute.

API Reference: `POST /send-payments/claims/{claim_id}/disputes/{event_id}/posting-status-responses`

To respond to a Send Posting Status dispute, create a `SendPaymentsApi` object. Then use method `sendPaymentsApi.postingStatusResponseCreate` to respond.

This method expects the `claimId`, `eventId`, and request body to be provided. The request body is an instantiation of the `PostingStatusResponseCreate` object.

```java
  public class Main {
    public static void main(String[] args) {
      // API client set up here...    
      
      SendPaymentsApi sendPaymentsApi = new SendPaymentsApi(client);
  
      PostingStatusResponseCreate body = new PostingStatusResponseCreate();
      body.setPostingStatusResponse(PostingStatusResponseCreate.PostingStatusResponseEnum.POSTED);
      body.setDocumentUploadedId("e59c3a2a9f4311ee8855eeee0afc63f1");
      body.setDocumentMemo("Cardholder letter.");
      
      try{
        PostingStatusResponseCreateEvent result = sendPaymentsApi.postingStatusResponseCreate(claimId, eventId, body);
        System.out.println(result);
      } catch (ApiException e){
        System.err.println("Exception when calling SendPaymentsApi#PostingStatusResponseCreate");
        System.err.println("Status code: " + e.getCode());
        System.err.println("Reason: " + e.getResponseBody());
        System.err.println("Response headers: " + e.getResponseHeaders());
        e.printStackTrace();
      }
    }
  }
```

#### Review the possible error codes associated with this request {#review-the-possible-error-codes-associated-with-this-request-1}

| HTTP Code |       Error Code       |    Description     |
|-----------|------------------------|--------------------|
| 400       | BAD_REQUEST            | Bad request        |
| 401       | NOT_AUTHORIZED_REQUEST | Unauthorized       |
| 403       | FORBIDDEN              | Forbidden          |
| 404       | RESOURCE_UNKNOWN       | Resource not found |

#### Verify response {#verify-response-1}

You should receive a 201 OK response. Returns the `eventId`.

## Step 11: Retrieve the document processing details {#step-11-retrieve-the-document-processing-details}

The Receiving Institution retrieves the document processing details of the uploaded documentation.

API Reference: `GET /documents/attributes`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 12: Retrieve list of claims in a queue {#step-12-retrieve-list-of-claims-in-a-queue}

The Receiving Institution uses this endpoint to retrieve claims from the Send Payment Receiving Institution Unworked queue.

API Reference: `GET /queues/{queue_id}/claims`

**Refer to [Step 4](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/queues-tutorial/index.md) of the [Queues](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/queues-tutorial/index.md) tutorial for more specific information on how to utilize this endpoint.**

## Step 13: Retrieve the claim details for an existing claim {#step-13-retrieve-the-claim-details-for-an-existing-claim}

The Receiving Institution retrieves the claim details for an existing claim.

API Reference: `GET /claims/{claim_id}`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) of the [Claims](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/claims-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 14: Upload documents {#step-14-upload-documents}

The Receiving Institution uploads documents.

API Reference: `POST /documents`

**Refer to [Step 1](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

## Step 15: Respond to a Send Payment dispute {#step-15-respond-to-a-send-payment-dispute}

Receiving Institutions use this endpoint to respond to a Send payment dispute.

API Reference: `POST /send-payments/claims/{claim_id}/disputes/{event_id}/responses`

To respond to a Send Payment dispute, create a `SendPaymentsApi` object. Then use method `sendPaymentsApi.createSendPaymentResponse` to respond.

This method expects the `claimId`, `eventId`, and request body to be provided. The request body is an instantiation of the `SendPaymentResponseCreate` object.

```java
  public class Main {
    public static void main(String[] args) {
      // API client set up here...    
      
      SendPaymentsApi sendPaymentsApi = new SendPaymentsApi(client);

      SendPaymentResponseCreate body = new SendPaymentResponseCreate();
      body.setResponse(SendPaymentResponseCreate.ResponseEnum.ACCEPT_RETURN_FUNDS);
      body.setDocumentUploadedId("e59c3a2a9f4311ee8855eeee0afc63f1");
      body.setDocumentMemo("Cardholder letter.");
      
      try{
        SendPaymentResponseCreateEvent result = sendPaymentsApi.createSendPaymentResponse(claimId, eventId, body);
        System.out.println(result);
      } catch (ApiException e){
        System.err.println("Exception when calling SendPaymentsApi#SendPaymentResponseCreate");
        System.err.println("Status code: " + e.getCode());
        System.err.println("Reason: " + e.getResponseBody());
        System.err.println("Response headers: " + e.getResponseHeaders());
        e.printStackTrace();
      }
    }
  }
```

#### Review the possible error codes associated with this request {#review-the-possible-error-codes-associated-with-this-request-2}

| HTTP Code |              Error Code               |                                                                       Description                                                                       |
|-----------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| 400       | BAD_REQUEST                           | Bad request                                                                                                                                             |
| 400       | CODE_210000                           | Invalid input length for field `memo`                                                                                                                   |
| 400       | SEND_RESPOND_REQUEST_MORE_INFORMATION | When response is set to `FIRST_REQUEST_FOR_MORE_INFORMATION` or `SECOND_REQUEST_FOR_MORE_INFORMATION`, you must provide `documentUploadedId` or `memo`. |
| 400       | INVALID_REQUEST                       | SEND - Response is invalid for the Send dispute                                                                                                         |
| 400       | CODE_250000                           | Missing required field `{memo}`                                                                                                                         |
| 401       | NOT_AUTHORIZED_REQUEST                | Unauthorized                                                                                                                                            |
| 403       | FORBIDDEN                             | Forbidden                                                                                                                                               |
| 404       | RESOURCE_UNKNOWN                      | Resource not found                                                                                                                                      |

#### Verify response {#verify-response-2}

You should receive a 201 OK response. Returns the `eventId`.

Return to [Tutorials](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/index.md).

## Step 16: Retrieve the document processing details {#step-16-retrieve-the-document-processing-details}

The Receiving Institution retrieves the document processing details of the uploaded documentation.

API Reference: `GET /documents/attributes`

**Refer to [Step 3](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) of the [Documents](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/documents-tutorial/index.md) tutorial for more specific information on how to use this endpoint.**

Return to [Tutorials](https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/index.md).
