> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Warranties Quickstart

> Getting started with the StateSet Warranty API

StateSet One provides a REST and GraphQL API for Warranty Management.

The Warranty Management module in StateSet includes various objects that facilitate replacement processes. These objects typically encompass:

* Warranty
* Warranty Line Items
* Redemptions
* Orders
* Shipments

### Warranty Management Overview

Warranty Management is a process that helps businesses manage their warranties. It involves tracking the status of warranties, processing claims, and providing customer support. StateSet's Warranty Management solution automates the entire warranty process, from generating warranty labels to processing claims. This helps in streamlining the process and reducing the time and effort required to manage warranties. The solution leverages the Temporal workflow orchestration framework to automate the various steps involved in warranty management. This includes generating and emailing warranty labels, creating warranties in StateSet, providing search capabilities for efficient record retrieval, updating customer support platforms with tracking information, and processing instant refunds. By automating the warranty process, StateSet enables businesses to effectively manage and track warranties, thereby enhancing customer experience and improving operational efficiency.

#### Challenges with Warranties Management

Warranty Management is a complex process that involves multiple steps and stakeholders. This makes it difficult for businesses to effectively manage and track warranties. Some of the key challenges include:

#### StateSet's Warranty Management Solution

StateSet's Warranty Management solution automates the entire warranty process, from generating warranty labels to processing claims. This helps in streamlining the process and reducing the time and effort required to manage warranties. The solution leverages the Temporal workflow orchestration framework to automate the various steps involved in warranty management. This includes generating and emailing warranty labels, creating warranties in StateSet, providing search capabilities for efficient record retrieval, updating customer support platforms with tracking information, and processing instant refunds. By automating the warranty process, StateSet enables businesses to effectively manage and track warranties, thereby enhancing customer experience and improving operational efficiency.

### Quickstart Guide

1. Setup your company's StateSet One instance by signing up at <a href="https://StateSet.com/sign-up">StateSet.com/sign-up</a>

2. Create a new API key in the StateSet Cloud Console <a href="https://cloud.StateSet.com/api-keys">cloud.StateSet.com/api-keys</a>

3. Install the StateSet-node SDK in your project:

```jsx theme={null}
npm install StateSet-node
```

4. Create a new Warranty

```jsx theme={null}

import { StateSet } from 'StateSet-node'('API_KEY');

const warranty = await StateSet.warranties.create({
  id: 'W-123313',
  order_id: 'O-12332312',
  serial_number: 'st123976879tm',
  'description:' 'Warranty Replacement for different type',
  'status': 'NEW'
  'reported_condition': 'A',
  'tracking_number': '132908231098120921',
  'zendesk_number': '123313',
  'action_needed': 'Replacement'
  'rma': 'W-123312',
  'country': 'US',
   warranty_line_items: [
    {id: 'WI-232133223'},
  ],
});

```

5. Approve Warranty

Once a Warranty is approved a replacement order will be created in your store.

```jsx theme={null}

import { StateSet } from 'StateSet-node'('API_KEY');

const warranty = await StateSet.warranties.approve(
 'W-123313'
);

```

### Advanced Warranty Automation using Temporal

```jsx javascript theme={null}

import { condition, proxyActivities } from '@temporalio/workflow';
import * as wf from '@temporalio/workflow';

const { userReturnedProduct, createZendeskComment, voidInvoice, updateWarranty, updateWorkflowId } = proxyActivities({
    startToCloseTimeout: '1 minute',
});

/** A workflow that simply calls an activity */
export async function warrantyConditionUpdatedWorkflow(body, zendesk_number) {

    let workflow_state = [];
    var condition = _condition;
    var replacement_order_created = _replacement_order_created;
    var ticket_id_int = zendesk_number;

    if ((replacement_order_created == true && condition == "A") || (replacement_order_created == true && condition == "B") || (replacement_order_created == true && condition == "C")) {

        // Void Invoice
        await voidInvoice(customer_email);

        // Create Zendesk Comment
        await createZendeskComment(ticket_id_int);

    } else if ((replacement_order_created == true && condition == "F")) {

        // Create Zendesk Comment
        await createZendeskComment(ticket_id_int);
    }
    
    await userReturnedProduct(customer_email);

    // Update Warranty
    var warranty_id = await updateWarranty();

    // Update Workflow Id
    await updateWorkflowId(warranty_id, wf.workflowInfo().workflowId);


    return 'updated'

}

```

### Warranties Support

If you have any questions or need help, please contact us at: <a href="mailTo:support@StateSet.com">[support@StateSet.com](mailto:support@StateSet.com)</a>
