# EC API version1.0
> [color=black] Server:tw-admin.injoifit.com
> Authorization:Bearer Token
---
## Get Bearer Token
* ### /api/auth
> [color=#b595e5] Method:POST
> [color=#e88f4c] Form-Data
| 參數名稱 | 類型 |必填|說明|備註|
| - | - | - | - | - |
| name| String | Y | 帳號 |
| password| String | Y | 密碼 |
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vdHctYWRtaW4uaW5qb2lmaXQuY29tL2FwaS9hdXRoIiwiaWF0IjoxNjczNTc5NzI5LCJleHAiOjE2NzM1ODMzMjksIm5iZiI6MTY3MzU3OTcyOSwianRpIjoic1VyRkZWZnRpZklZVlZwUSIsInN1YiI6IjEiLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.GiGJRe-ZGoBo_Y4UbDVt5FaAqqlKwq5HR6CmYuIF6lo",
"token_type": "bearer",
"expires_in": 3600
},
"error": {}
}
```
---
## Orders
### Get orders
* ### /api/shopify/orders
> [color=#b595e5] The maximum number of results to show on a page.
> limit ≤ 250 default 50
> Method:GET
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"orders": [
{
"id": 3988010664141,
"admin_graphql_api_id": "gid://shopify/Order/3988010664141",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
...
...
...
}
```
---
### Get single order
* ### /api/shopify/orders/{shopify_order_id}
> [color=#b595e5] Method:GET
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3988010664141,
"admin_graphql_api_id": "gid://shopify/Order/3988010664141",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
...
...
...
}
```
---
### Get orders count
* ### /api/shopify/orders/count
> [color=#b595e5] Method:GET
> [color=#e88f4c] Response
``` JSON
{
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"count": 1
}
],
"error": {}
}
}
```
---
### Create Order
* ### /api/shopify/orders
> [color=#b595e5] Method:POST
> [color=#e88f4c] JSON
``` JSON
{"order":{"line_items":[{"variant_id":41061406671053,"quantity":1},{"variant_id":41061406703821,"quantity":2}],"customer":{"id":5457932058829},"financial_status":"pending"}}
```
> [color=#e88f4c] Response
``` JSON
{
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3987931791565,
"admin_graphql_api_id": "gid://shopify/Order/3987931791565",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
...
...
...
}
```
---
### Delete Order
* ### /api/shopify/orders/{shopify_order_id}
> [color=#b595e5] Method:DELETE
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{}
],
"error": {}
}
```
---
### Cancel Order
* ### /api/shopify/orders/{shopify_order_id}/cancel
> [color=#b595e5] Method:POST
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3988782710989,
"admin_graphql_api_id": "gid://shopify/Order/3988782710989",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": "other",
"cancelled_at": "2022-11-04T11:29:10+08:00",'
...
...
...
```
---
### Close Order
* ### /api/shopify/orders/{shopify_order_id}/close
> [color=#b595e5] Method:POST
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3988782710989,
"admin_graphql_api_id": "gid://shopify/Order/3988782710989",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": "other",
"cancelled_at": "2022-11-04T11:29:10+08:00",
"cart_token": null,
"checkout_id": null,
"checkout_token": null,
"closed_at": "2022-11-04T11:46:14+08:00",
...
...
...
```
---
### Open Order
* ### /api/shopify/orders/{shopify_order_id}/open
> [color=#b595e5] Method:POST
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3988782710989,
"admin_graphql_api_id": "gid://shopify/Order/3988782710989",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": "other",
"cancelled_at": "2022-11-04T11:29:10+08:00",
"cart_token": null,
"checkout_id": null,
"checkout_token": null,
"closed_at": null,
...
...
...
```
---
### Update Order
* ### /api/shopify/orders/{shopify_order_id}
> [color=#b595e5] Method:PUT
``` JSON
{"order":{"id":3989332820173,"email":"eason2@gmail.com"}}
```
> [color=#e88f4c] Response
``` JSON
{
"status": "success",
"code": 200,
"message": "",
"data": [
{
"order": {
"id": 3989332820173,
"admin_graphql_api_id": "gid://shopify/Order/3989332820173",
"app_id": 5586747393,
"browser_ip": null,
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
"cart_token": null,
"checkout_id": null,
"checkout_token": null,
"closed_at": "2022-11-04T14:01:10+08:00",
"confirmed": true,
"contact_email": "eason2@gmail.com",
"created_at": "2022-11-04T13:21:30+08:00",
"currency": "TWD",
...
...
...
"email": "eason2@gmail.com",
...
...
...
```
---
## Payments
### Redirect Hitrust
* ### /api/orders
> [color=#b595e5] Method:Post
> Content-Type: 'application/x-www-form-urlencoded'
```
{
customer: customer.id
product[]: variant.id
}
```
> [color=#e88f4c] Response
response:
redirectTo Hitrust
---