A refund is a record of the money returned to the customer, and/or the return of any items on an order which may or may not have been restocked.
Authenticated access scopes: com.read_orders, com.write_orders
What you can do with Refund
The Haravan API lets you do the following with the Refund resource.
- GET https://apis.haravan.com/com/orders/{order_id}/refunds.json Retrieves a list refund of order
- GET https://apis.haravan.com/com/orders/{order_id}/refunds/{refund_id}.json Retrieves single refund of the order.
- POST https://apis.haravan.com/com/orders/{order_id}/refunds.json Create a refund for an existing Order.
Refund properties
Endpoints
Retrieves a list all refund of order. You can filter resources by params.
fields | comma-separated list of fields to include in the response. |
Retrieve all refund order.
GET https://apis.haravan.com/com/orders/1231656323/refunds.json
HTTP/1.1 200 OK
{ "refunds": [ { "created_at": "2021-10-15T07:36:32.377Z", "id": 1011637849, "note": "wrong size", "refund_line_items": [ { "id": 1013304743, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 0.0000, "price": 15000000.0000, "product_id": 1035729103, "quantity": 3, "requires_shipping": true, "sku": "S0710A-2", "title": "SP0710A", "variant_id": 1078450814, "variant_title": null, "vendor": "14S", "name": "SP0710A", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1308268732, "quantity": 1 } ], "restock": true, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [] }, { "created_at": "2021-10-15T07:38:26.889Z", "id": 1011637904, "note": "wrong size", "refund_line_items": [ { "id": 1013304806, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 0.0000, "price": 15000000.0000, "product_id": 1035729103, "quantity": 3, "requires_shipping": true, "sku": "S0710A-2", "title": "SP0710A", "variant_id": 1078450814, "variant_title": null, "vendor": "14S", "name": "SP0710A", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1308268732, "quantity": 2 } ], "restock": true, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [] }, { "created_at": "2021-10-15T07:43:05.12Z", "id": 1011638030, "note": "hoàn tiền", "refund_line_items": [], "restock": null, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [ { "amount": -1500000.0000, "authorization": null, "created_at": "2021-10-15T07:43:05.115Z", "device_id": null, "gateway": "Thanh toán khi giao hàng (COD)", "id": 1094983274, "kind": "refund", "order_id": 1231656323, "receipt": null, "status": "Thành công", "test": false, "user_id": 200000497867, "location_id": 963414, "payment_details": null, "parent_id": null, "currency": "VND", "haravan_transaction_id": null, "external_transaction_id": null, "send_email": false, "is_cod_gateway": false } ] } ] }
List all refund of order, showing only some attributesr.
GET https://apis.haravan.com/com/orders/1231656323/refunds.json?fields=restock,refund_line_items
HTTP/1.1 200 OK
{ "refunds": [ { "created_at": "2021-10-15T07:36:32.377Z", "id": 1011637849, "note": "wrong size", "refund_line_items": [ { "id": 1013304743, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 0.0000, "price": 15000000.0000, "product_id": 1035729103, "quantity": 3, "requires_shipping": true, "sku": "S0710A-2", "title": "SP0710A", "variant_id": 1078450814, "variant_title": null, "vendor": "14S", "name": "SP0710A", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1308268732, "quantity": 1 } ], "restock": true, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [] }, { "created_at": "2021-10-15T07:38:26.889Z", "id": 1011637904, "note": "wrong size", "refund_line_items": [ { "id": 1013304806, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 0.0000, "price": 15000000.0000, "product_id": 1035729103, "quantity": 3, "requires_shipping": true, "sku": "S0710A-2", "title": "SP0710A", "variant_id": 1078450814, "variant_title": null, "vendor": "14S", "name": "SP0710A", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1308268732, "quantity": 2 } ], "restock": true, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [] }, { "created_at": "2021-10-15T07:43:05.12Z", "id": 1011638030, "note": "hoàn tiền", "refund_line_items": [], "restock": null, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [ { "amount": -1500000.0000, "authorization": null, "created_at": "2021-10-15T07:43:05.115Z", "device_id": null, "gateway": "Thanh toán khi giao hàng (COD)", "id": 1094983274, "kind": "refund", "order_id": 1231656323, "receipt": null, "status": "Thành công", "test": false, "user_id": 200000497867, "location_id": 963414, "payment_details": null, "parent_id": null, "currency": "VND", "haravan_transaction_id": null, "external_transaction_id": null, "send_email": false, "is_cod_gateway": false } ] } ] }
Retrieve a refund of order by specifying the ID.
Retrieves single refund of order by ID.
GET https://apis.haravan.com/com/orders/1231656323/refunds/1011637849.json
HTTP/1.1 200 OK
{ "refund": { "created_at": "2021-10-15T07:36:32.377Z", "id": 1011637849, "note": "wrong size", "refund_line_items": [ { "id": 1013304743, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 0.0000, "price": 15000000.0000, "product_id": 1035729103, "quantity": 3, "requires_shipping": true, "sku": "S0710A-2", "title": "SP0710A", "variant_id": 1078450814, "variant_title": null, "vendor": "14S", "name": "SP0710A", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1308268732, "quantity": 1 } ], "restock": true, "user_id": 200000497867, "order_id": 1231656323, "location_id": null, "transactions": [] } }
Create a Refund for an existing Order.
restock | Boolean, whether or not to add the line items back to the store inventory. |
notify | Boolean, set to |
note | An optional comment attached to a refund. |
refund_line_items | Array of line item IDs and quantities to refund. |
transactions | Array of transactions to process as refunds. |
Create a new refund for an order.
POST https://apis.haravan.com/com/orders/1234121123/refunds.json
{ "refund": { "restock": true, "notify": true, "note": "restock", "refund_line_items": [ { "line_item_id": 1312358460, "quantity": 1 } ], "transactions": [ { "amount": 100000, "kind": "refund" } ] } }
HTTP/1.1 201 Created
{ "refund": { "created_at": "2021-10-15T11:37:43.0230186Z", "id": 1011644929, "note": "restock", "refund_line_items": [ { "id": 1013315622, "line_item": { "fulfillment_service": null, "fulfillment_status": null, "grams": 10.0000, "price": 400000.0000, "product_id": 1028183686, "quantity": 1, "requires_shipping": true, "sku": "AO551", "title": "Váy Quây dài", "variant_id": 1061514767, "variant_title": null, "vendor": "Khác", "name": "Váy Quây dài", "id": 0, "barcode": null, "properties": null }, "line_item_id": 1312358460, "quantity": 1 } ], "restock": true, "user_id": 200000497867, "order_id": 1234121123, "location_id": null, "transactions": [ { "amount": -100000.0, "authorization": null, "created_at": "2021-10-15T11:37:43.0145178Z", "device_id": null, "gateway": "Thanh toán khi giao hàng (COD)", "id": 1095037982, "kind": "refund", "order_id": 1234121123, "receipt": null, "status": "Thành công", "test": false, "user_id": 200000497867, "location_id": 963414, "payment_details": null, "parent_id": null, "currency": "VND", "haravan_transaction_id": null, "external_transaction_id": null, "send_email": false, "is_cod_gateway": false } ] } }