Merchant API: testing cancellations in your sandbox
About this article
This article describes the tests to run before you go live with the cancellation endpoints of the Merchant API, and the checklist to confirm with your ChannelEngine implementation contact. For background on how cancellations work, refer to Merchant API: cancellations.
Table of contents
Test 1: retrieve cancellations
Introduction
Run these tests to confirm that your cancellation integration works end to end. Work through the tests in order, log the results, and share them with your ChannelEngine implementation contact before sign-off.
Requirements
- Staging or sandbox environment: a ChannelEngine staging environment or dedicated sandbox.
- Merchant API key: the key of your sandbox environment.
- Test orders: at least two acknowledged test orders without a shipment.
Test 1: retrieve cancellations
Goal: confirm that your integration retrieves cancellation records from ChannelEngine and correctly distinguishes merchant cancellations from channel cancellations.
Create a merchant cancellation and a test channel cancellation. To simulate a channel cancellation, create a test cancellation on ChannelEngine via the web interface. Create a cancellation on a test order, select Channel (Test) in the Created by field, and the cancellation is created with IsMerchantCreator set to false.
- Open a test order on ChannelEngine and click Create cancellation. Select Merchant in Created by and save the cancellation.
- Open a second test order, click Create cancellation, select Channel (Test) in Created by, and save the cancellation.
- Call
GET /v2/cancellations/merchantwithout filters. Expected: HTTP 200 and both cancellations in the response. - Call the endpoint again with
UpdatedSinceset to a recent timestamp. Expected: only cancellations updated since that timestamp are returned. - Check the
IsMerchantCreatorfield of each record. Expected: your integration routes the record withIsMerchantCreatorset tofalseto your stop-fulfillment workflow, and treats the record withtrueas your own cancellation.
Record your results: HTTP status, polling by UpdatedSince works (yes or no), and IsMerchantCreator correctly identified (yes or no).
Test 2: submit a cancellation
Goal: confirm that your integration submits a merchant cancellation correctly.
- Retrieve an acknowledged test order that has no shipment and note its
MerchantOrderNo. - Call
POST /v2/cancellationswithIsMerchantCreatorset totrue, aReasonCode, and all order lines at their full quantities. Expected: a successful response, and the cancellation is queued for export to the marketplace. - Call
GET /v2/cancellations/merchantfiltered by yourMerchantCancellationNo. Expected: the cancellation appears with the matching order reference, lines, and reason code.
Record your results: HTTP status, cancellation visible in the GET response (yes or no), and partial cancellation tested (yes, no, or not applicable).
Sign-off checklist
Before you go live, confirm all of the following with your ChannelEngine implementation contact:
- A unique
MerchantCancellationNois generated and stored for every cancellation, and never reused. - Your integration polls
GET /v2/cancellations/merchantregularly and usesUpdatedSinceto avoid retrieving the full history on every call. - Your integration checks
IsMerchantCreatorin the response and routes channel cancellations to your stop-fulfillment workflow. - Your integration detects cancellation requests through
GET /v2/ordersand confirms them withPOST /v2/cancellationsafter fulfillment is stopped. - Merchant cancellations are submitted only for orders that have no shipment on ChannelEngine.
- The marketplace guide of each channel is checked for merchant cancellation support, and
ChannelOrderSupportis checked before you submit a partial cancellation. - If you sell on marketplaces with enforced cancellations, shipments are recorded on ChannelEngine at the moment of carrier handover and not in a delayed batch.
- Every cancellation uses the most accurate
ReasonCode, andOTHERis not used as a default. - (If applicable) Partial cancellation support is verified against the cancellation model of each channel before creating partial cancellations.
Next steps
- Merchant API: cancellations (endpoints, fields, and cancellation flows).
- ChannelEngine: cancellations (handle cancellations via the ChannelEngine web interface).
Comments
0 comments
Article is closed for comments.