Refunds via API
Integration Overview
The Refund API lets you refund customers through Global-e, covering the following refund use cases :
Full order
Full product
Partial product
Shipping
Duties & Taxes
Service gestures and appeasements
Deduction of return shipping
Any combination of the above
Depending on the use case, refunds can be requested in either merchant or customer currency values, eg. products have a valuation in both currencies when service gestures or duties do not.
Customer currency amounts are overall preferred for implementation and allow coverage of all use cases.
Prerequisites
The following attributes are required in the system (OMS/ERP/MW) executing the Refunds calls:
Global‑e order number (and not ecommerce platform or another system)
Product “
cartItemId
” or “SKU
” as specified in the cart shared between Global‑e and the ecommerce platform
Full Refunds and Total Amount Logic
CreateOrderRefund (OrderRefundDetails orderRefund, List<RefundProduct> refundProductsList)
Issues refund for the order specified in orderRefund argument.
Optionally may include the list of RefundProducts or components (service gesture, shipping or duties&taxes) to refund for.
Total refund amounts
If orderRefund.TotalRefundAmount is not specified, it will be converted to the end customer’s currency based on RefundAmount or OriginalRefundAmount values for the RefundProducts in refundProductsList and their respective Product VAT rates.
For Full order refunds
If orderRefund.FullRefund is specified as true:
A full refund will be created
refundProductsList should not be provided, otherwise, the call will fail with the "Full refund requested but list of RefundProduct is not empty." error.
orderRefund.TotalRefundAmount and orderRefund.OriginalTotalRefundAmount values (if provided) in the call will be ignored. Amounts will be recalculated based on the order details.
For Partial order refunds
If product.RefundAmount AND product.OriginalRefundAmount are not specified then:
product.RefundAmount AND product.OriginalRefundAmount will be calculated based on the order products’ price
orderRefund.TotalRefundAmount is recalculated based on the product's refund amount plus orderRefund.ServiceGestureAmount
Refund Input Validation
At least one component must exist in the request (Shipping, Duties, Service Gesture or Products)
If a product was provided, the requested quantity to refund is > 0
Verify that the sum of all requested refund components equals the requested total refund amount
For “Full Refund” requests, the system will verify that no amounts were provided in the request
If a refund was requested in both merchant currency (i.e. Original Currency) and customer currency, the amount provided in the merchant currency will be ignored. The system will recalculate the amount in merchant currency based on the amount provided in the customer currency
Implementation
API Call
API Endpoint: CreateOrderRefund
POST request URL: https://connect.bglobale.com/Order/CreateOrderRefund?merchantGUID=abcdabcd-abcd-abcd-abcd-abcdabcdabcd
Call parameters
MerchantGUID
: Unique Merchant Identifier and API token Different for Test and Live environments.
OrderRefund
Parameter | Type | Description | Mandatory? |
OrderId | Global‑e Order id | Mandatory | |
FullRefund | boolean | (Optional Boolean) refund the entire order (product, shipping, taxes) | Optional |
TotalRefundAmount | Preferred (Optional) - Total order level refund amount (product + components) in Customer currency (taken from SendOrderToMerchant values) | Preferred - Optional | |
OriginalTotalRefundAmount | (Optional) Total order level refund amount (product + components) in Merchant currency (taken from SendOrderToMerchant values) | Optional | |
ProductsDutiesRefund | boolean | (Optional Boolean) For products to be refunded also refund the associated duties to the customer (auto-calculated, thus incompatible with DutiesAmount, TotalRefundAmount or OriginalTotalRefundAmount) | Optional |
ShippingRefund | boolean | (Optional Boolean) Refund shipping was paid by the customer on the initial order | Optional |
| | Add the reason for the refund of the order level (for logging on to the Global‑e side). Requires mapping on the Global‑e side. | Optional If the |
string | | ||
string | | ||
ServiceGestureAmount | (Optional) amount denotes additional funds refunded to the customer on top of the other components – in customer currency | Optional | |
ShippingAmount | (Optional) amount denotes the funds that should be refunded due to shipping cost – in customer currency | Optional | |
DutiesAmount | (Optional) amount denotes the funds that should be refunded due to Duties, Taxes and CCF costs – in customer currency | Optional | |
| String | Add comments about the refund, | Optional |
| String | Optional. If the externalReference is provided upon successful refund creation, it will be saved in the OrderRefunds table and included in the Refunds Components report. Max length: 255. | |
| String | The amount deducted from the refund, in the customer's currency. | Optional Must be enabled by Global-e |
| String | The amount tdeducted from the refund, in the original/merchant's currency. | Optional Must be enabled by Global-e |
RefundProduct
list body [array]
Parameter | Description | Mandatory? |
---|---|---|
CartItemId | Unique product line level identifier at order level as provided in GetCheckoutCartInfo and returned in SendOrderToMerchant | |
sku | SKU code used to identify the product on the Merchant’s site (to be mapped on the Global‑e side) | Mandatory if CartItemId is not specified. |
RefundQuantity | The product line quantity to refund. If the amount attributes are not specified, a full refund is initiated for (product unit * quantity). For returnable products, use "null" for the refund attribute. | Mandatory if appeasements are not enabled. |
OriginalRefundAmount | Preferred if not full product amount (optional) - Total product line refund amount in Merchant currency, if partial will be backwards pro-rated for reconciliation | Optional |
RefundAmountPercent | (optional) Total product line refund amount in %. | Optional |
RefundAmount | (optional) Total product line refund amount in Customer currency, if partial will be pro-rated for customer values from transaction amounts The amount must include domestic VAT if applicable. | Optional |
OrderRefundReasonObject* (see above table) | (optional) provide product line level reason to be logged on the Global‑e side | Optional |
RefundComments | (optional) provide comments to be logged on the Global‑e side | Optional |
SAMPLES
Examples in this section are descriptive and may involve redundancy in attribute declaration.
Parameters: OrderRefund
{ "OrderId": "GE95135467GB", "TotalRefundAmount": "60.95", "RefundReason": { "OrderRefundReasonCode": 8, "Name": "Damaged Item" }, "RefundComments": "Damaged shipment but the customer kept it" }
Body: RefundProductList with List<RefundProduct>
[{ "CartItemId": "1381109", "RefundQuantity": "1", "RefundAmount": "60.95", "RefundReason": { "OrderRefundReasonCode": 8, "Name": "Damaged Item" }, "RefundComments": "Damaged shipment but the customer kept it" } ]
API Response
If success: OrderRefundInfo
Parameter | Type | Description |
---|---|---|
Success | Boolean | Indicates if the respective API method was successful |
Reason | String | Text that optionally describes the reason for the Success status |
NotifyOrderRefund | Merchant.OrderRefund | Notifies the merchant about Global-E initiated refund issued to the end customer. |
Merchant.OrderRefund
Parameter | Type | Description |
---|---|---|
MerchantOrderId | String | Order unique identifier on the Merchant’s site |
RefundId | String | Recorded refund id on the Global‑e side |
MerchantGUID | String | Unique identifier of the Merchant on Global-e |
Products | List<Merchant.RefundProduct> | List of Refund Product objects for this order refund |
Components | List<Merchant.RefundComponent> | List of RefundComponent objects for this order refund |
OrderId | String | Global‑e order unique identifier |
TotalRefundAmount | Decimal | The total refund amount in the end customer’s currency used for this order’s payment |
RefundReason | Merchant.OrderRefundReason | Reason for the order refund |
RefundComments | String | Comments for the order refund |
OriginalTotalRefundAmount | Decimal | The refund amount in the original Merchant’s currency including the local Merchant’s VAT |
ServiceGestureAmount | Decimal | “Service gesture” amount in the customer’s currency is included in TotalRefundAmount. |
WebStoreCode | String | Code used on the merchant’s side to identify the web store |
WebStoreInstanceCode | String | Code used on the merchant’s side to identify the web store instance where the current cart is originating from |
FullRefund | Boolean | The flag indicating that the full refund of the order should be performed (product,shipping,taxes) |
Merchant.RefundProduct
Parameter | Type | Description |
---|---|---|
CartItemId | String | Identifier of the line item on the Merchant’s site |
sku | String | SKU code used to identify the product on the Merchant’s site (to be mapped on the Global‑e side) |
RefundQuantity | Int64 | Product quantity |
OriginalRefundAmount | Decimal | Refund the amount in the original Merchant’s currency including the local Merchant’s VAT for this product line item, before applying any price modifications |
RefundAmount | Decimal | The refund amount for this product line item in the end customer’s currency used for this order’s payment |
RefundReason | Merchant.OrderRefundReason | Reason for this product’s refund |
RefundComments | String | Comments for this product’s refund |
Merchant.RefundComponent
Parameter | Type | Description |
---|---|---|
Amount | Decimal | The refund amount in customer currency |
OriginalAmount | Decimal | The refund amount in merchant currency |
IsChargedToMerchant | Decimal | If this component is charged to the merchant, the flag is TRUE (default). If this component is charged to Global-E, the flag is FALSE. If the same component is split between charged to the merchant and charged to Global-E, it should appear twice, each time with a different value in IsChargedToMerchant. Exception is a component PrepaidReturn – it should always be IsChargedToMerchant = TRUE |
RefundAmount | Decimal | The refund amount for this product line item in the end customer’s currency used for this order’s payment |
ComponentType | String | Products, Shipping, Duties, PrepaidReturn or ServiceGesture. |
Merchant.OrderRefundReason
Parameter | Type | Description |
---|---|---|
OrderRefundReasonCode | Decimal | Code denoting the order refund reason on the Merchant’s site |
Name | String | Order refund reason name |
If failure: ErrorInfo
Parameter | Type | Description |
---|---|---|
Success | Boolean | Indicates if the call has succeeded. FALSE denotes an error or failure |
Code | String | Error code to be returned when an error occurs |
Error | String | In case of an error, this property indicates the error message text |
Description | String | In case of an error, this property indicates the error message description |
Success response: OrderRefundInfo
{ "Success": true, "Reason": "Refund generated with id 67961", "NotifyOrderRefund": { "MerchantOrderId": "orderid123", "RefundId": "67961", "MerchantGUID": "39a4ffdsfds-f6324b-41ce-afdsfa-c8ef18234132", "Products": [ { "CartItemId": "2", "RefundQuantity": "1", "OriginalRefundAmount": "31.2707", "RefundAmount": "60.9500", "RefundReason": { "OrderRefundReasonCode": null, "Name": "Undefined" }, "RefundComments": "Damaged shipment but the customer kept it" } ], "Components": [ { "Amount": "60.95", "OriginalAmount": "31.27", "IsChargedToMerchant": "TRUE", "ComponentType": "Products" } ], "OrderId": "GE95135467GB", "TotalRefundAmount": "60.95", "RefundReason": { "OrderRefundReasonCode": null, "Name": "Undefined" }, "RefundComments": "Damaged shipment but the customer kept it", "OriginalTotalRefundAmount": "31.27", "ServiceGestureAmount": "0", "WebStoreCode": null, "WebStoreInstanceCode": "GlobalEDefaultStoreInstance", "FullRefund": false } }
General API error as ErrorInfo:
{ "Code": "error code", "Error": "error message", "Description": "error description" }
Object processing error as OrderRefundInfo: (Reason is optional)
{ "Success": false, "Reason": "Processing error detail", "NotifyOrderRefund": null }
Use Cases Samples
Examples of headers and body - Note: No refund comments or reasons are used in samples.
{{geApiUrl}}/Order/CreateOrderRefund?merchantGUID={{guid}}&orderRefund=<orderRefundSample>
Full Order Refund
For full order refunds, no refund value is required. Global‑e will establish it from order. This will include Shipping as well as Duties & Taxes.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "FullRefund": true } |
Full Product Refund
For full product refunds, no refund value is required. Global‑e will establish it from order.
Single product
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB" } | [ { "CartItemId": "1381109", "RefundQuantity": 1 } ] |
Multiple Products
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB" } | [ { "CartItemId": "1381109", "RefundQuantity": 2 }, { "CartItemId": "2371567", "RefundQuantity": 1 } ] |
Products with associated duties paid by the customer
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "ProductsDutiesRefund": true } | [ { "CartItemId": "1381109", "RefundQuantity": 1 }, { "CartItemId": "2371567", "RefundQuantity": 1 } ] |
Product with shipping
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "ShippingRefund": true } | [ { "CartItemId": "1381109", "RefundQuantity": 1 } ] |
Shipping Only
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "ShippingRefund": true } | [] |
Partial Product Refunds
For partial product refunds, a refund value is required. It should be provided:
in customer currency value ideally (“Amount” attributes)
or as percentage
or failing that merchant currency value can be accepted to be reused as a prorated calculation (“OriginalAmount” attributes)
The total amount of refund is expected in parameters if amounts are provided.
Using Customer Currency
Example: Customer order placed in Australian dollars. Refunding 320 AUD of the product value.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "TotalRefundAmount": "320" } | [ { "CartItemId": "1381109", "RefundQuantity": null, "RefundAmount": "320" } ] |
Using Percentage
Example: Customer order placed in Australian dollars. Refunding 50% of product value for a product not being returned.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB" } | [ { "CartItemId": "1381109", "RefundQuantity": null, "RefundAmountPercent": "50" } ] |
Components Refunds
For components refunds, customer currency value is required.
The total amount of refund is expected in the parameters for input control.
Shipping Refund
Example: Customer order placed in Australian dollars. Refunding 10 AUD for shipping cost.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "ShippingAmount": "10", "TotalRefundAmount": "10" } | [] |
Service gesture
Example: Customer order placed in Australian dollars. Refunding 50 AUD as a service gesture because of a delay in dispatch.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "ServiceGestureAmount": "50", "TotalRefundAmount": "50" } | [] |
Duties Refund
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", "DutiesAmount": "60", "TotalRefundAmount": "60" } | [] |
Product Return Refund with Shipping
In such a scenario, the Duties&Taxes would not necessarily be expected to be refunded, in which the refund must not be triggered as a full order refund (which would include D&T).
Example order for these sections goes as follows:
1 product at 500 CNY
Shipping at 40 CNY
Pre-paid duties of 60 CNY
Item is refunded in full thus amount is not required, only for shipping.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "GE95135467GB", " ShippingAmount": "40", } | [ { "CartItemId": "1381109", "RefundQuantity": 2 } ] |
Shipping Only
Example: A German shopper is returning an item to a US merchant.
The return shipping cost is €5.00 so the merchant deducts €5.00 from the refund.
Headers | Body |
---|---|
OrderRefund= { "OrderId": "#4999", "CustomerPrepaidRefundAmount":5 } | [ { "CartItemId":"12935475658836", "RefundQuantity":"1", "RefundComments":"02-Wrong Product" } ] |
Error Codes Reference
When calling the API, the following error codes may be returned.
Generic Validation Errors
ErrorInfo
# | Context | HTTP status | ErrorInfo |
---|---|---|---|
1 | Validation – refundProductsList is not null or empty | 400 | { Code = "NullParameter", Error = string.Format("Parameter {0} was null", parameterName), Description = string.Format("Please provide a valid value for the {0} parameter", parameterName) } |
2 | Validation –orderRefundObj is not null | 400 | { Code = "NullParameter", Error = string.Format("Parameter {0} was null", parameterName), Description = string.Format("Please provide a valid value for the {0} parameter", parameterName) } |
3 | Validation – orderId is not null | 400 | { Code = "NullParameter", Error = string.Format("Parameter {0} was null", parameterName), Description = string.Format("Please provide a valid value for the {0} parameter", parameterName) } |
4 | Validation – Multiple refunds | 400 | {Code = "MULTI_REFUND_DISALLOWED", Error = "Multiple refund requests are disallowed for this order and reason", Description = "This refund request is rejected because multiple refunds are disallowed for the same order and the same reason code"} |
ResponseInfo
For the validations below, we do not return an ErrorInfo object but a different object – ResponseInfo.
# | Context | HTTP status | ResponseInfo |
---|---|---|---|
1 | Validation – Order was not found | 400 | { Success = false, Reason = string.Format("Order {0} could not be found"} |
2 | Validation – The order does not belong to the merchant | 400 | { Success = false, Reason = string.Format("Order {0} doesn't belong to this merchant", order.OrderId) } |