# Submit fraud tutorial
source: https://developer.mastercard.com/mastercom-extended/documentation/tutorials-and-guides/fraud-tutorial/index.md

## Overview {#overview}

This tutorial will show you how to submit a transaction as confirmed fraud to Mastercom Extended for submission to the Fraud and Loss Database.

## 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 issuer searches for transactions.
Note: The transaction search response will contain any claims in Mastercom Extended already associated with the transaction. Claims from the Mastercom API v6 system will not be included in this response.
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 issuer creates a claim for the selected transaction.
Alert: If a claim has previously been created in Mastercom v6 for a transaction, an attempted Mastercom Extended Claim Creation API call (POST /claims) will yield an error message indicating a claim has already been created for this transaction in the Mastercom v6 system.

**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.**

API Reference: `POST /claims`

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

The issuer 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: Submit confirmed fraud {#step-4-submit-confirmed-fraud}

The issuer submits a transaction as confirmed fraud to Mastercom Extended for submission to the Fraud and Loss Database.

API Reference: `POST /claims/{claim_id}/frauds`

To submit fraud, create a `ReportFraud` object. Then use method `fraudApi.reportFraud` to submit request.

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

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

    FraudApi fraudApi = new FraudApi(client);
    
    ReportFraud body = new ReportFraud();
    body.setAccountDeviceType("N_1_CHIP_ONLY_WITH_PIN");
    body.setFraudType("N_00_LOST_FRAUD");
    body.setFraudSubType("K_CONVENIENCE_OR_BALANCE_TRANSFER_CHECK_TRANSACTION");
    body.setCardInPossession("YES");

    try {
      String result = fraudApi.reportFraud(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling FraudApi#reportFraud");
      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                |                                               Error Description                                               | Error Code |
|-----------|------------------------------------|---------------------------------------------------------------------------------------------------------------|------------|
| 400       | INVALID_REQUEST                    | Request unsuccessful. Submit a new request.                                                                   | 200002     |
| 400       | INVALID_INPUT_LENGTH               | Invalid input length. Input length cannot be more than 1000 characters.                                       | 210000     |
| 400       | INVALID_FORMAT                     | Invalid format for field `fieldName`                                                                          | 220000     |
| 400       | CRTE_FRD_INVALID_TYPE_SUBTYPE_COMB | Invalid combination of `fraudType` and `fraudSubType`. Resubmit valid values.                                 | 220029     |
| 400       | CRTE_FRD_DUPLICATE_REPORT          | Confirmed Fraud previously reported for this transaction. See FLD to confirm again or delete the transaction. | 220030     |
| 400       | INVALID_INPUT_VALUE                | Invalid `fieldName`. Resubmit valid value.                                                                    | 230000     |
| 400       | MISSING_REQUIRED_INPUT             | Missing required field `{{0}}`                                                                                | 250000     |

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

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

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