# GetOrderDetails API

#### **Base URL :**

{% hint style="info" %}

> **`Staging :`** [**https://stagingaccount.xoxoday.com/chef**](https://stagingaccount.xoxoday.com/chef)
>
> **`Production :`** [**https://accounts.xoxoday.com/chef**](https://accounts.xoxoday.com/chef)
> {% endhint %}

{% tabs %}
{% tab title="Request" %}

```bash

curl -X POST {OAUTH_URL}/v1/oauth/api 
-H 'Authorization: Bearer eyJ0b2tlbkNvbnRlbnQiOnsiaXNzdWVkRm9yIjoiRnJlc2h3b3JrcyIsInNjb3BlIjoiIiwiaXNzdWVkQXQiOjE1NTk4MDQ1Nzg1ODIsImV4cGlyZXNBdCI6IjIwMTktMDYtMjFUMDc6MDI6NTguNTgyWiIsInRva2VuX3R5cGUiOiJVU0VSIn0sImFfdCI6ImV5SmxibU1pT2lKQk1USTRRMEpETFVoVE1qVTJJaXdpWVd4bklqb2lSVU5FU0MxRlV5SXNJbXRwWkNJNkltVnVZeUlzSW1Wd2F5STZleUpyZEhraU9pSkZReUlzSW1OeWRpSTZJbEF0TWpVMklpd2llQ0k2SWpoMmJVTkVRMUZQZW1wQlNHWndabXQ0TVhjNVluZHphM1JhZWtRek0ySXRZamx0VVhSclEyRnhNV3NpTENKNUlqb2lZMGR0V2kxdWIySjBWbUptTVdGdVNraDBUMmxoWW5VMFZHUlVhRzVVYmpCYWRuWnJabGMwYzBWb2N5SjlmUS4uU1h3TlNUSWhFUXNlN0htaXpPUmFIQS5NRzBVUy1lek1IOEFsbWFLc2ZTY3Nwa2FlYzBIcW9FcUV1YXRoNHRSTTRpeVg2dFByX1ZjTnlsdnk5YjlGLTZHR01DbjY1TjYwYnpIUUJtRVZvZGRYVWlvQS1kTkpuaE9KdThHczRfeW9pM042VGFOdWhjRENCUGtwWk1CeTlDRjJBaEh4UGotQkd0SzdEamhNbjBBQXpTM1VhTE11eUdrTmNwSGxQSUxNcFlVM' 
--header 'Content-Type: application/json'
  -d '{
	"query": "plumProAPI.mutation.getOrderDetails",
	"tag": "plumProAPI",
	"variables": {
		"data":{
			"poNumber": "",
			"orderId": 1316578,
                      “sendMailToReceiver”: 0
		}
	}
}

```

{% endtab %}

{% tab title="Response" %}

#### `200 : Success`

`returns the details of the order`

```bash
{
    "data": {
        "getOrderDetails": {
             status: 1,
             data:{
               "orderId": 1,
               "vouchers":[{
                 "amount": "10",
                 "country": "India",
                 "currency": "INR",
                 "orderId": 128618,
                 "pin": "key_c26323726135beaa4e",
                 "productId": 28543,
                 "tag": "somethingToTagThisOrder",
                 "type": "codePin",
                 "validity": "2020-10-02",
                 "voucherCode": "4162581029814703",
                 "currencyValue": 0.1,
               }],
               "amountCharged": 90,
               "currencyCode": "USD",
               "discountPercent": 10,
               "orderDiscount": 10,
               "orderTotal": 100,
               "orderStatus": "complete",
               "deliveryStatus": "pending"
             }
           }
    }
}
```

#### `401 : Failure`

`Invalid Authorization header`

```
{
	   code: 401,
	   errorId: "PIPE10013",
	   errorInfo: "Plum Pro APIs: Invalid authorization header",
   	   error:"Eg: invalid authorization header!"
}
```

#### `400 : Failure`

`Validation error in order details`

```
{
	   code: 400,
	   errorId: "PLE10002",
	   errorInfo: "Validation error in get order details",
  	   error:"Eg: Bad request"
}
```

#### `404 : Failure`

`Failed to get order details`

```
{
	   code: 404,
	   errorId: "PLE10016",
	   errorInfo: "Failed to get Order details",
           error: "Eg: Not Found, Order Details Not Found"
}
```

#### `502 : Failure`&#x20;

`Failed to process resend vouchers`

```
{
      code: 502,
      errorId: "PLE10034",
      errorInfo: "Failed to process resendVoucher",
      error: "Invalid Order status id."
}
```

#### `500: Failure`

`Internal server error`

```
{ 
   code: 500, 
   error: "Eg: Internal server error"
}
```

{% endtab %}
{% endtabs %}

## Parameters

{% tabs %}
{% tab title="Request " %}

#### Body Parameters

| `Property`                  | `Type`   | **`Description`**                                                             |
| --------------------------- | -------- | ----------------------------------------------------------------------------- |
| `poNumber`                  | `String` | `poNumber or client side order id`                                            |
| `orderId`**`*`**            | `String` | `Xoxoday side orderId`                                                        |
| `sendMailToReceiver`**`*`** | `String` | `sendMailToReceiver to 1 if order details needed in receiver's email as well` |

{% hint style="info" %}
**"\*"means the request parameter is mandatory**
{% endhint %}
{% endtab %}

{% tab title="Response" %}

#### `Body Parameters`

| `Property`               | `Type`    | `Description`                                                                                                    |
| ------------------------ | --------- | ---------------------------------------------------------------------------------------------------------------- |
| `status`                 | `Integer` | `0 (Failure) / 1 (Successful)`                                                                                   |
| `orderId`                | `Integer` | `Order id of the order`                                                                                          |
| `tag`                    | `String`  | `The tag of the order`                                                                                           |
| `amountCharged`          | `String`  | `Amount charged for the order in INR,`                                                                           |
| `currencyCode`           | `String`  | `Currency code for the currency that the client was charged in`                                                  |
| `currencyValue`          | `String`  | `Currency Value will be showing the exchange rate between the base currency of the account and product currency` |
| `discountPercent`        | `Float`   | `Percentage of discount if any`                                                                                  |
| `orderDiscount`          | `Float`   | `Discount amount based on discount Percent`                                                                      |
| `orderTotal`             | `Float`   | `Order total of the order excluding the discount`                                                                |
| `orderStatus`            | `String`  | `Order place status of the order`                                                                                |
| `deliveryStatus`         | `String`  | `Product delivery status of the order`                                                                           |
| `vouchers`               | `Array`   | `Array of vouchers ordered`                                                                                      |
| `vouchers.productid`     | `Integer` | `Product Id of the product`                                                                                      |
| `vouchers.voucherCode`   | `String`  | `Voucher Code or url based on the type parameter`                                                                |
| `voucher.pin`            | `String`  | `Pin for the voucher if applicable`                                                                              |
| `vouchers.validity`      | `String`  | `The validity of the voucher`                                                                                    |
| `vouchers.amount`        | `String`  | `Denomination of the voucher ordered`                                                                            |
| `vouchers.currency`      | `String`  | `The currency of the ordered product`                                                                            |
| `vouchers.currencyValue` | `Float`   | <p><code>The value used for currency conversion to the currency of the product.</code><br></p>                   |
| `vouchers.country`       | `String`  | `Countries that the product can be redeemed in`                                                                  |
| `vouchers.type`          | `String`  | `Type of voucher. For eg: code \| codePin \| url \| URL + Pin`                                                   |

{% hint style="info" %}
**vouchers.xyz= vouchers property objects**
{% endhint %}
{% endtab %}
{% endtabs %}
