Skip to main content

Flipkart

Purpose​

Orders, catalog, inventory, and settlements, through the Flipkart Marketplace Seller API (https://api.flipkart.net/sellers).

Authentication​

OAuth authorization code flow. Access and refresh tokens are kept encrypted on the IntegrationConnection. A 401 refreshes the access token once, under a per-channel lock.

Flipkart documents access tokens as valid for 60 days and refresh tokens for 180. The refresh token expiry is recorded in the connection's credentials and, unencrypted, in its config.refreshTokenExpiresAt. Flipkart may not send the lifetime; a refresh token that changed is then taken as good for 180 days, and one that did not keeps its recorded date. ConnectionTokenExpiryScheduler flags the connection 21 days ahead and marks it EXPIRED after. A refresh Flipkart rejects (400 or 401) also marks it EXPIRED. Authorizing again sets it back to CONNECTED and clears the warning.

Orders​

FlipkartOrderService.syncOrders, run by the ORDER sync job. The search API (POST /v3/shipments/filter/) has no modified-date filter, so each run makes six searches, each paged until hasMore is false (20 per page, 5000 records at most):

SearchWindowCreates orders
preDispatch, all five statesnone: the open queue is read wholeyes
postDispatch, NORMAL and SELF separately (the API requires it)modifiedDate since lastOrderSync less 24 hoursyes
cancelled, one per cancellation typecancellations since lastOrderSync less 24 hoursno, updates only

With no lastOrderSync, the date windows reach back 30 days. modifiedDate is in Flipkart's API spec (the platform docs and the official Java SDK's Filter model) but not in the older seller-portal reference; Flipkart accepts it for postDispatch. In practice that search returns very few of a seller's dispatched shipments with either modifiedDate or orderDate, which is why held orders are followed by id (below).

The searches find new orders, but cannot follow an order to the end: once a shipment leaves the open queue it has to be found again by the postDispatch search, which in practice returned almost none of a seller's dispatched orders (Flipkart does not document how it applies date filters to it), and returns (RETURN_REQUESTED, RETURNED) are in no search type (they are read from the Returns API, below). So after the searches, every order from the last 30 days that is not CANCELLED or RETURNED and that no search returned is re-read by shipment id (GET /v3/shipments?shipmentIds=, 100 per call), and moved to its current state.

lastOrderSync moves only when every search and both Returns API reads finished. A failed search does not stop the others; the job then fails and is retried. The re-read of held orders is best effort and never fails the job: it is by shipment id, not the cursor's window, and runs every time. A 100-id lookup Flipkart fails is tried again 25 ids at a time; what still fails is skipped (logged and reported) and re-read next run, and after three failed lookups in a row the re-read stops for that run. A shipment whose updatedAt matches the copy stored on the order is skipped.

Last, returns are read from the Returns API (GET /v2/returns), once for customer_return and once for courier_return (RTO), modifiedAfter the same cursor less 24 hours, 25 per page. While hasMore is true, the nextUrl Flipkart returns is fetched, as the shipment searches follow nextPageUrl. It comes back as /returns/search/<base64 filter>, relative to the API version like the v2 orders search's nextPageURL, so it is fetched under /v2 (FlipkartClientService.getReturnsPage); under the seller API base alone it answers 500. Paging stops at the same page cap as the searches, and the cursor is then held. Each entry of returnItems is one order item's return:

  • status is lower case: init, created, service_requested, completed, cancelled, rejected, cancellation_in_progress (seen in Flipkart's own search filter; the API reference does not enumerate it). completed (or received/returned) moves the line to RETURN_RECEIVED and the order to RETURN_RECEIVED; cancelled or rejected leaves the order alone, and the shipment re-read moves it back; anything else moves the line to RETURN_INITIATED and the order to RETURN_REQUESTED. The channel status is written as RETURNED or RETURN_REQUESTED, as the shipment feed reports it.
  • Only the line named by orderItemId moves. The order status goes through the channel transition, so an order with a fulfillment keeps its status.
  • With the channel's autoCreateReturns set, a return docket is created (type RTO for courier returns), keyed by shipmentId like the dockets the shipment re-read creates, so a return seen by both gets one docket; trackingId becomes the return AWB. A completed return marks the docket RETURN_RECEIVED. Returned quantities are counted by the docket, not by the sync.
  • A failed Returns API call fails the step, so lastOrderSync is held.

For each changed shipment, GET /v3/shipments/{shipmentIds} supplies the delivery address, tracking ID and courier. The address goes through the shared address handler like every channel's: Flipkart's unchanged address is an echo of the original, so an edit made in PointNXT is kept, and a shipped order's address is never moved (see Integrations overview).

Status is read per order item (Flipkart v3 carries it there). An order split over several shipments keeps all its lines: a line missing from one payload is carried over, never retired, and totals and status come from every line. The order takes the least advanced state of its live items, and is CANCELLED only when every item is.

The line between PENDING and FULFILLED is the parcel reaching the courier, as with Amazon's Unshipped:

Flipkart item stateOrder status
APPROVED, PACKING_IN_PROGRESS, FORM_FAILED, PACKED, READY_TO_DISPATCHPENDING: still to be fulfilled, stock held, awaiting confirmation to the warehouse
PICKUP_COMPLETE, SHIPPEDFULFILLED
DELIVEREDDELIVERED
RETURN_REQUESTED / RETURNEDRETURN_REQUESTED / RETURN_RECEIVED
CANCELLED (every item)CANCELLED
some items with the courier, some notPARTIALLY_FULFILLED

Packed and ready-to-dispatch stay PENDING because both can be done in Seller Hub without the parcel leaving; FULFILLED would also make the order billable to settlement before dispatch.

Per shipment, Order.config.flipkart.shipments[shipmentId] keeps updatedAt, status, dispatchByDate, hold, location, item ids, tracking ID and courier. From those:

  • Order.latestShipDate is the earliest dispatchByDate of shipments not yet dispatched.
  • A held shipment puts the order ON_HOLD with reason Held by Flipkart. When Flipkart lets go, only that reason is cleared. Channel status cannot move an order that already has a fulfillment, so this parks only orders not yet confirmed.
  • paymentMode is COD when Flipkart says the buyer pays on delivery. The order stays fully PAID: Flipkart collects COD and settles it with everything else, so no courier COD remittance is expected.
  • For a seller-shipped order, a tracking ID raises order.channel-awb.reported (see Events), which records the AWB on the fulfillment being packed.
  • The same shipments are written to Order.config.channelTracking, the shape Amazon writes too, and returned on the order as channelTracking. The admin order page shows them as "Marketplace shipment", which is the only tracking an order shipped from Seller Hub has.

Requests​

Every call has a 30 second timeout. A 429 or 503 is retried up to three times, and so is a read (GET) answered 500, 502 or 504 ("A call to dependent system failed. Please retry after some time"); a write is not, since it may have gone through. Retries happen after Flipkart's Retry-After (capped at 60 seconds), else after 1, 2 and 4 seconds. Each channel has at most three calls in flight across all processes, the same budget as INVENTORY_CONCURRENCY.FLIPKART; Flipkart publishes no rate limit. If no slot frees within 30 seconds, or the cache is down, the call is sent anyway.

Each order sync logs one line with its call count and duration, why shipments were skipped (unchanged, not ours to import, or without ids), and what every step returned, for example postDispatch:NORMAL fetched 0 (created 0, updated 0, skipped 0).

Webhooks​

None. Flipkart's notification service needs onboarding through Flipkart support and is not built. Orders arrive by polling.

Inventory​

flush-channel:FLIPKART.

Settlements​

The Reports API (settled_transaction_ledger) when the channel's enableReportsApi is set, otherwise file upload. A Flipkart file parser is present beside Amazon and Meesho.

Code​

src/integrations/flipkart.

Failure​

Shared sync circuit breaker and inventory per-item results. In order sync, one shipment that cannot be imported is counted as failed and the rest of the page continues.