Skip to main content

Documentation Portal

Refund Methods

 

CreateOrderRefund (Merchant to Global-e)

The  CreateOrderRefund API Issues a refund for the order specified in the orderRefund argument. Optionally, this method may include the list of RefundProducts to refund. If orderRefund.TotalRefundAmount is not specified, it is converted to the end customer’s currency based on the RefundAmount or OriginalRefundAmount values for the RefundProducts in the refundProductsList and their respective Product VAT rates.

If orderRefund.FullRefund is specified as true:

  • A full refund is created.

  • refundProductsList should not be provided, otherwise, the call fails with an error "Full refund requested but list of RefundProduct is not empty."

  • The orderRefund.TotalRefundAmount and orderRefund.OriginalTotalRefundAmount values which are provided in the call are ignored and recalculated based on the order details.

ELSE

If product.RefundAmount AND product.OriginalRefundAmount are not specified then:

  • product.RefundAmount AND product.OriginalRefundAmount are calculated based on the order product price.

  • orderRefund.TotalRefundAmount is recalculated based on the products refund amount plus the sum of all non-product related refund components

    (orderRefund.ServiceGestureAmount + orderRefund.DutiesAmount + orderRefund.ShippingAmount)

In case a full refund is not performed or the refund request/refund item quantity is not valid, a JSON response is returned in accordance to the Merchant Account Settings ReturnResponseOfErrorInfoStruct value.

  • If this Merchant Account Settings is true, the JSON response is in the ErrorCode struct.

  • Otherwise, the response is in the ResponseInfo struct.

The Merchant Account Settings ‘SetAllPrepaidReturnsWithRefund’ supports all prepaid returns includes free by Admin and free by Merchant that the return IDcwill be sent to NotifyOrderRefund and wiil link the OrderRefund with the return.  

Method/URL

POST https://{globale_api_domain}/Order/CreateOrderRefund
Parameters

Request

Name

Type

Description

Mandatory

orderRefund

Object OrderRefundDetails

Order refund details for the specified order

Yes

refundProductsList

List of RefundProduct

List of RefundProduct objects for this order refund.

Note that this products list is mandatory if the refund is issued for Products.

Response

Name

Type

Description

Mandatory

responseInfo

Object ResponseInfo

Response information for the API call.

No

Errors

Error Codes

The ErrorInfo includes a field code containing a numeric value.

Code

Description

1001

Order already fully refunded or cancelled

1002

Requested refund amount is greater than the remaining amount available for a refund for this order

1003

Invalid quantity

1004

Refund request must contain at least one refund component

1005

Cartitemid {currentRefundProduct.CartItemId} doesn’t exists for order {orderRefundObj.OrderId

1006

CartItemId {currOrderProduct.CartItemId} exceeded the quantity of the available products to refund

Examples

Request

[
   {
        "CartItemId": "134643",
        "RefundQuantity": "1",
        "RefundAmount": "42",
        "RefundReason": {
            "OrderRefundReasonCode": "RETURN",
            "Name": "RETURN"
        },
        "RefundComments": ""
    }, {
        "CartItemId": "134644",
        "RefundQuantity": "1",
        "RefundAmount": "58",
        "RefundReason": {
            "OrderRefundReasonCode": "RETURN",
            "Name": "RETURN"
        },
        "RefundComments": ""
    }
]

Response Error

{
    "Code": "1006",
    "Error": "Cartitemid 1 exceeded the available products quantity to refund",
    "Description": "After Method ValidateProducts. refund amount: 67.8700 , available loyalty points: 0.0000"
}
CreateOrderRefund API - Out of Stock

The Out of Stock (OOS) feature allows merchants to indicate products as out-of-stock through the CreateOrderRefund API without specifying the refund amount.

This feature enabled the following actions:

  • Modification of the product quantity.

  • Recalculation of duties and taxes.

  • Adjustment of shipping costs (if there are no flat rates).

  • The update of associated documents.

  • The Issuing of a product refund.

  • If all the products within an order are indicated as out of stock, the order status is changed to 'Cancelled by Merchant'.

Refunds

  • The out-of-stock quantities are indicated by using the product quantity field.

  • Any provided amount associated with a product with an out-of-stock refund reason is ignored.

  • If out-of-stock is provided for a product that a product appeasement is made for, only the remaining amounts are refunded.

Mapping

Out-of-stock products must be assigned a pre-mapped refund reason in order to be recognized by the system.

Mapping is established between the merchant's refund reasons and Global-e's internal reasons, as specified in the MapMerchantOrderRefundReasons table,

Examples of codes in the MapMerchantOrderRefundReasons table

Code

Refund Reason

5

Out of Stock

14

Out-of-Stock Item

23

Product out of stock

Errors

Validation Errors

The following situations cause the amend and refund operation to fail and return an error in the CreateOrderRefund response.

Situation

Error Message

Combining various refund reasons, including out-of-stock and non-out-of-stock reasons, within a single CreateOrderRefund request.

"Issuing a refund for out-of-stock products alongside other refund reasons is not permitted. Please include any out-of-stock products in a separate call without other refund reasons."

If the quantity of out-of-stock products exceeds the quantity of remaining products.

"The number of out-of-stock products exceeds the number of remaining products."

If the quantity of out-of-stock products is zero or not provided.

"Out-of-stock quantity missing or zero. Please provide a valid quantity."

If a product is declared as out-of-stock for an order in a not allowed status.

Note: Out-of-stock products can only be declared for pre-shipped products.

“The current order status %Order status name% does not permit the declaration of out-of-stock products”.

Example
[
   {
      "CartItemId":"39493377065032-0",
      "RefundQuantity":1,
      "RefundAmount":79.00,
      "RefundReason":{
         "OrderRefundReasonCode":"Out of stock",
         "Name":"Out of stock"
      }
   },
   {
      "CartItemId":"39638402039880-1",
      "RefundQuantity":1,
      "RefundAmount":0.00,
      "RefundReason":{
         "OrderRefundReasonCode":"Out of stock",
         "Name":"Out of stock"
      }
   }
]
GetRefundDetails (Merchant to Global-e)

This API provides information about refunds associated with an order. The information includes all the refund details and the refundable amount for each product in the order.

The API returns:

  • MerchantOrderRefund

  • Credit note URL

Method/URL

GET https://{globale_api_domain}/v1/orders/{orderId}/refunds
Parameters

Response

Name

Type

Description

MerchantOrderRefund

Object Merchant.OrderRefund

Object containing details about the refundable amount for the order.

Errors

Code

Description

400

Bad Request.

Information cannot be parsed or violates Global-e policies. For example: Order ID not found.

500

Request was successfully parsed with no violations detected, but there was a failure during request handling.

Examples

Response

{
  "OrderId": "string",
  "MerchantOrderId": "string",
  "MerchantInternalOrderId": "string",
  "WebStoreCode": "string",
  "WebStoreInstanceCode": "string",
  "Refunds": [
    {
      "RefundID": "string",
      "RMANumber": "string",
      "MerchantRMANumber": "string",
      "FullRefund": true,
      "ProductsDutiesRefund": true,
      "ShippingRefund": true,
      "RefundAsGiftCard": null,
      "TotalRefundAmount": "string",
      "OriginalTotalRefundAmount": "string",
      "ServiceGestureAmount": "string",
      "TotalMoneyRefundAmount": "string",
      "DutiesAmount": "string",
      "ShippingAmount": "string",
      "CustomerPrepaidRefundAmount": "string",
      "OriginalCustomerPrepaidRefundAmount": "string",
      "TotalGiftCardsRefundAmount": "string",
      "TotalGiftCardsRefundAmountinMerchantCurrency": 0,
      "TotalLoyaltyPointsRefunded": 0,
      "TotalLoyaltyPointsRefundAmount": 0,
      "GiftCardsData": [
        {
          "CardId": 0,
          "OtherFields": "..."
        }
      ],
      "ExternalReference": "string",
      "InitiatedBy": "string",
      "CurrencyCode": "string",
      "OriginalCurrencyCode": "string",
      "RefundReason": {
        "OrderRefundReasonCode": "string",
        "Name": "string"
      },
      "RefundProducts": [
        {
          "CartItemId": "string",
          "RefundQuantity": "string",
          "RefundAmount": "string",
          "OriginalRefundAmount": "string",
          "RefundAmountPercent": "string",
          "RefundReason": "string",
          "RefundComments": "string",
          "Sku": "string",
          "ProductCode": "string",      
          "productGroupCode": "string",            
          "ProductCodeSecondary": "string",
          "productGroupCodeSecondary": "string"      
        }
      ],
      "RefundComponents": [
        {
          "Amount": "string",
          "OriginalAmount": "string",
          "IsChargedToMerchant": "string",
          "ComponentType": "string"
        }
      ],
      "RefundComments": "string",
      "RefundDocument": [
        {
          "DocumentData": "string",
          "CreditNoteUrl": "string",
          "DocumentTypeCode": "string",
          "DocumentTypeName": "string",
          "DocumentExtension": "string"
        }
      ]
    }
  ],
  "RefundableAmount": {
    "CurrencyCode": "string",
    "TotalCreditAmount": 0,
    "RefundableShippingAmount": 0,
    "RefundableDutiesAmount": 0,
    "ProductRefundableAmount": [
      {
        "CartItemId": "string",      
        "Sku": "string", 
        "ProductCode": "string",      
        "productGroupCode": "string",            
        "ProductCodeSecondary": "string",
        "productGroupCodeSecondary": "string",        
        "RefundableTotalAmount": 0,
        "RefundableQuantity":1
      }
    ]
  }
}

Error

{
   "error": {
        "code": "String",
	"message": "String",
	"description": "String"	
   }
}