Narvar Shopify RMA Spec
Retailer Hosted Endpoint
You can use webhook subscriptions to receive notifications about particular events on your product returns. Currently, Narvar webhooks must be configured by a Narvar support engineer, and cannot be enabled from within the Shopify Admin dashboard, currently. There are two endpoints here – one is the RMA webhook to receive updates from Narvar, and the other is Refund Approval endpoint for your warehouse to send updates to Narvar. These are decribed below.
RMA webhook
After you configure a webhook subscription, the events that you specified will trigger a webhook notification each time they occur. This notification contains a JSON payload, and HTTP headers that provide context.The following are the headers that you can expect to have.
X-Narvar-Topic: initiated
X-Narvar-Timestamp: 1614146162
X-Narvar-Shop-Domain: mycrofood.myshopify.com
X-Narvar-API-Version: 1.07
X-Narvar-Webhook-Id: b54557e4-bdd9-4b37-8a5f-bf7d70bcd043
List of supported webhook events and topics
You can retrieve data only in JSON format. Webhooks are available for the following events:
- initiated - This event is called when a new return is initiated by a customer.
- on_its_way_to_retailer - This event is called when a return is dropped off by a customer at a carrier.
- delivered_to_retailer - This event is called when a return is delivered by a carrier to the merchant, or is dropped off by the customer at the retailer store
- approved - This event is called when a return is approved by the retailer
- cancelled_by_retailer - This event is called when a return is cancelled by the retailer
- cancelled_by_user - This event is called when a return is cancelled by the user ( prior to drop off or return to retailer).
- rejected - This event is called when a return is rejected by the retailer
- exception - This event is called when Narvar encounters an error in processing the return
- out_of_stock_exception - This event is called when an exchange cannot be completed because an item is out of stock
- resolve_manually_without_automation - This event is called when a retailer decides to handle an exception manually
Refund Approval endpoint
You will use this endpoint to send updates from your warehouse to Narvar. This endpoint is hosted by Narvar. You can set the status of the items received for refund as well as change the refund amounts at the item-level and order-level as needed.
Authentication
This endpoint is used to send the status of the return, refunds and exchanges to third party systems. The webhook is triggered by Narvar whenever there is a change in the returns data due to data received by Narvar, or a user action on the Narvar platform.
Basic Auth Username Password Verification
You will provide Narvar with a username and password that Narvar will encode using Base64 and pass as the Basic Auth parameter. Pseudocode is given below.
header = "#{webhook.basic_username}:#{webhook.basic_password}"
b64 = Base64.encode64(header)
{
'Authorization' => "Basic " + b64,
'Content-Type' => 'application/json'
}
Request body
RMA details
This represents the status of the return during its journey to the distribution centre.
This field is populated right after a return is initiated.
This field is populated when we receive a first scan event from the carrier.
This field is populated when we receive a delivered scan event from the carrier.
This event is called when a return is approved by the retailer.
This event is called when a return is cancelled by the retailer.
This field is populated when an user chooses to cancel the return.
This event is called when a return is rejected by the retailer.
This event is called when Narvar encounters an error in processing the return.
This event is called when an exchange cannot be completed because an item is out of stock.
This event is called when a retailer decides to handle an exception manually.
When Narvar creates the RMA number it will be passed in this field
Original order number for the order
Date when a return was created on the Narvar platform
Retailer name as it is stored in the Narvar system
This object will contain details package containing the returned item/s
The carrier tracking number for the package
Carrier used to delivery the package
Class of service used for the package
Destination area of the return
Destination city for the return
Destination country for the return
Fee associated with the return shown to the end user in the returns process
Location ID of the destination
Method selected for the return. Only if MAIL is selected will a corresponding “package” object be sent
When customer ships the product via mail.
When the customer returns it in store.
When the customer returns on their own.
When customer choose the printerless option.
When customer gets the keep the item and the refund is issued without receiving items to the DC
Sent as “true” if the return was initiated by a gift recipient
Email associated with the return. When “gift” is “true” this will contain the gift recipient email collected by Narvar during the returns flow.
Locale that was used to initiate the return
Zip code of the return package origin
City of the return package origin
Country of the return package origin
Amount shown to the end user in the returns process as the estimated refund
Restocking fee shown to the end user during the returns process
Narvar will host the packing slip and label URL as a PDF. This is the URL to access that PDF
This is the refund method the user chose at the last step of the returns workflow.
If the user chose to receive the refund via Gift Card.
If the user chose to receive the refund in the original payment method.
Array of the items being returned
SKU of the item being returned
Unique identifier of the item being returned
Quantity being returned
Reason for the return selected by the end user
Reason code for the return selected by the end user
Comments entered by the end user during the return process. 300 character max
Unit price of the item being returned
Unit price * Quantity being returned
This denotes if the item is a return or exchange
If the item is a return
If the item is an exchange
Title of the exchange item
Variant ID of the exchange item.
Variant SKU
Exchange options chosen by the user.
Note: color and size are examples - fields may vary based on the Inventory API integration.
Name of the variant
Value
Product ID of the exchange item
Quantity of items exchanged
Indicates whether the item is kept
Child reason if any
Child reason code if any
Status of the item
Number of items in this status
epoch when event was recorded
The event at which the refund should be issued
Number of days after inititation refund can be issued
Number of days after inititation draft order can be mark as paid ( in case of an exchange)
Number of days after inititation restock automation can be done
Number of days after inititation inventory for an exchange will be held
List of all transactions that have happened
Unique ID of the transaction
Epoch at which this transaction occured
Source that originated this event
Autoamtion Rule inititated
An agent issued on our platform
From Shopify
Third party API
Amount that was refunded
Currency of transaction
Refund back to original payment
Issue a Shopify Gift Card
Issue an instant refund in good faith
Adjust an instant refund
ID of the gift card issued
Gateway that was used to issue refund
Examples
Responses
SUCCESS
Body
No payload is required in the response to Narvar. We will ignore any data sent back. Any request that is not a 200 will be treated as an error, and will be retried.
Authentication
This API endpoint allows you to send Narvar approval of items after receiving them in your warehouse. This can also be triggered by your ERP systems. If you want Narvar to issue a partial refund, you have to set the refund override amounts. By default, if an item is marked as not_received
, then that item won’t be refunded.
Refund amount changes
If only a partial refund needs to be issued, you need to specify the refund_override
amount for each of the item, as well as any order level refund_adjustment
( this would have been shipping and handling fees we would show end user), and the final total_refund_override
amount. We will ensure that total of all the item level refunds amounts and the refund_adjustment
amounts add up to total_refund_override
amount.
Basic Auth with HMAC Verification
Narvar will provide you with an application_secret
that will be used in the Basic Auth verification creation.
The basic auth username will be current timestamp in UTC as epoch seconds. For reference, Saturday, February 27, 2021 11:15:24 AM
will be 1614424524
.
The password is the signature generated using a hash-based message authentication code (HMAC) with SHA-256 and the application secret shared with you directly by your Narvar Implementation engineer i.e. HMAC.SHA256
( application_secret
, signed_payload
) where signed_payload
is created by concatenating the timestamp ( passed as username), the character ‘.’ and the actual JSON payload (i.e. the request body).
You will provide Narvar with a username and password that Narvar will encode using Base64 and pass as the Basic Auth parameter.
Pseudocode (Ruby) is given below.
user_name = Time.now.to_i
signed_payload = user_name + "." + body.to_json
password = OpenSSL::HMAC.hexdigest("SHA256", application_secret, signed_payload)
header = "#{user_name}:#{password}"
b64 = Base64.encode64(header)
{
'Authorization' => "Basic " + b64,
'Content-Type' => 'application/json'
}
Request parameters
RMA Number previously created by Narvar
Shipping / handling fees at the order level
Currency for the shipping / handling fees
Total refund amount that will be issued to the customer ( needed if this is different from the original amount)
Currency for the above total refund amount.
Issue refund in Shopify. If set to false, no refund is actually issued.
Unique reference ID that indicates this transaction. We will ignore additional updates with the same reference_id if the first call was successful.