Skip to content

Order Update API

This resource can be used to send the order updates to Pincode, in the form of unit-level actions that need to be applied.

Types of actions(sample structure for the actions can be found in the request payload mentioned below):

  • ORDER_FULFILMENT_STATE_UPDATE
    • Valid fulfillmentState: PACKING/PACKED/OUT_FOR_DELIVERY/DELIVERED
  • ITEM_UNIT_UPDATE
  • Valid reasons:
Date Added 'reason' Value
12/08/2024 SELLER_REFUND_ACCEPTED
12/08/2024 RESOLUTION_SLA_BREACHED
12/08/2024 SELLER_REJECTED_AGENT_VERIFIED
12/08/2024 INCORRECT_DESCRIPTION
12/08/2024 ITEM_NOT_IN_PRESCRIPTION
12/08/2024 QUANTITY_EXCEED_PRESCRIPTION_LIMIT
12/08/2024 QUANTITY_EXCEED_AVAILABLE_LIMIT
12/08/2024 ITEM_UNAVAILABLE
12/08/2024 ITEM_CANCEL_ON_CUSTOMER_REQUEST
12/08/2024 REASON_NOT_LISTED
  • ORDER_STATE_UPDATE
  • Valid orderState: ACCEPTED/IN_PROGRESS/COMPLETED/CANCELLED
  • Valid reason:
Date Added Order State 'reason' Value
12/08/2024 CANCELLED BUYER_NO_CONTACT
12/08/2024 CANCELLED BUYER_NOT_AVAILABLE
12/08/2024 CANCELLED BUYER_REFUSED_DELIVERY
12/08/2024 CANCELLED DELIVERY_PINCODE_UNSERVICEABLE
12/08/2024 CANCELLED DELIVERY_VEHICLE_ISSUES
12/08/2024 CANCELLED INCORRECT_PRICING
12/08/2024 CANCELLED ITEM_UNAVAILABLE
12/08/2024 CANCELLED SUSPICIOUS_ORDER_ACTIVITY
12/08/2024 CANCELLED TRADER_ORDER
12/08/2024 CANCELLED WEATHER_RELATED_ISSUES
12/08/2024 CANCELLED BUYER_ITEM_QTY_UPDATE
12/08/2024 CANCELLED LOCATION_NOT_FOUND
12/08/2024 CANCELLED CUSTOMER_CANCEL_REQUEST
12/08/2024 CANCELLED BUYER_ADDRESS_UPDATE
12/08/2024 CANCELLED BUYER_ITEMS_UPDATE
12/08/2024 CANCELLED EMPLOYEE_UNAVAILABILITY
12/08/2024 CANCELLED DELIVERY_PERSONNEL_UNAVAILABLE
27/09/2024 CANCELLED INVALID_PRESCRIPTION
27/09/2024 CANCELLED FRAUD_PRESCRIPTION

Authentication:
As explained in the Authentication section, this API requires the Authentication token as a header.

Coordinates
Staging: seller-network-testing.pincode.com
Production: shopping-network.phonepe.com

Resource: POST /tsp/order/v1/update

curl --request POST \
--url 'https://seller-network-testing.pincode.com/tsp/order/v1/update' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: O-Bearer <token>' \ 
--data ' {
  "requestContext": {
    "requestId": "OMS2402220921362644329327",
    "transactionId": "OD2401121901140533863584",
    "actionType": "UPDATE"
  },
  "orderId": "OD2401121901140533863584",
  "actions": [
    {
      "type": "ORDER_FULFILMENT_STATE_UPDATE",
      "fulfilmentId": "OF2401121901140543863862",
      "fulfillmentState": "OUT_FOR_DELIVERY"
    },
    {
      "type": "ITEM_UNIT_UPDATE",
      "itemId": "OI2401121901140543863671",
      "itemUnits": 2,
      "reason": "item quantity update"
    },
    {
      "type": "ORDER_STATE_UPDATE",
      "orderState": "IN_PROGRESS",
      "reason": "MERCHANT_REJECTED"
    },
    {
      "type": "CLIENT_ORDER_INFO_UPDATE"
      "clientOrderInfo": {
        "sellerInvoiceId": "SID6878043335837373810302"
      }
    } 
  ]
}
import requests

url = 'https://seller-network-testing.pincode.com/tsp/order/v1/update'
headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': f'O-Bearer {token}'
}
data = {
  "requestContext": {
    "requestId": "OMS2402220921362644329327",
    "transactionId": "OD2401121901140533863584",
    "actionType": "UPDATE"
  },
  "orderId": "OD2401121901140533863584",
  "actions": [
    {
      "type": "ORDER_FULFILMENT_STATE_UPDATE",
      "fulfilmentId": "OF2401121901140543863862",
      "fulfillmentState": "OUT_FOR_DELIVERY"
    },
    {
      "type": "ITEM_UNIT_UPDATE",
      "itemId": "OI2401121901140543863671",
      "itemUnits": 2,
      "reason":"item quantity update"
    },
    {
      "type": "ORDER_STATE_UPDATE",
      "orderState": "IN_PROGRESS"
    }
  ]
}
response = requests.post(url, headers=headers, json=data)

Successful Response:

{
  "requestContext": {
    "requestId": "OMS2402220921362644329327",
    "transactionId": "OD2401121901140533863584"
  },
  "response": {
    "id": "OD2401121901140533863584",
    "items": [
      {
        "itemId": "OI2401121901140543863671",
        "name": "cold drink",
        "platformItemId": "L1213:FC12",
        "serviceProviderItemId": "sp123242",
        "fulfillmentId": "OF2405200539030657485731",
        "quantity": {
          "count": 2
        },
        "price": {
          "value": 15000
        },
        "sellingPrice": {
          "value": 12500
        },
        "images": [
          {
            "image": "https://cdn.phonepe.com/23982938"
          }
        ],
        "prescriptionRequired": true,
        "displayMeasurement": "2L"
      }
    ],
    "orderState": "Completed",
    "serviceProvider": {
      "id": "P1",
      "platformId": "L1289313:FC08312"
    },
    "billing": {
      "name": "Loren Lpsum",
      "address": {
        "building": "410 Lorem Lpsum",
        "locality": "----",
        "city": "Vadodara",
        "state": "Gujarat",
        "country": "IND",
        "pincode": "390011",
        "formattedAddress": "Room No 410, Lorem Lpsum Training Institute",
        "lat": 22.28182220459,
        "lon": 73.202598571777
      },
      "email": "[email protected]",
      "phone": "8686868686",
      "createdAt": "2024-02-21T10:41:53.842Z",
      "updatedAt": "2024-02-21T10:41:53.842Z"
    },
    "fulfillments": [
      {
        "fulfillmentId": "OF2405200539030657485731",
        "type": "STORE",
        "ownerType": "RETAIL_SERVICE_PROVIDER",
        "end": {
          "address": {
            "building": "410 Lorem Lpsum",
            "locality": "----",
            "city": "Vadodara",
            "state": "Gujarat",
            "country": "IND",
            "pincode": "390011",
            "formattedAddress": "Room No 410, Lorem Lpsum Training Institute",
            "lat": 22.28182220459,
            "lon": 73.202598571777
          },
          "contact": {
            "phone": "8686868686"
          },
          "person": {
            "name": "Loren Lpsum"
          }
        },
        "fulfillmentState": "PACKED",
        "fulfilmentStatusHistory": {
          "PACKED": {
            "actual": {
              "endTime": 1722576698000
            },
            "expected": {
              "endTime": 1722576698000
            },
            "promised": {
              "endTime": 1722573098000
            }
          },
          "PACKING": {
            "actual": {
              "endTime": 1722572438000
            }
          }
        }
      },
      {
        "fulfillmentId": "OF2401121901140543863862",
        "type": "DELIVERY",
        "ownerType": "RETAIL_SERVICE_PROVIDER",
        "end": {
          "address": {
            "building": "410 Lorem Lpsum",
            "locality": "----",
            "city": "Vadodara",
            "state": "Gujarat",
            "country": "IND",
            "pincode": "390011",
            "formattedAddress": "Room No 410, Lorem Lpsum Training Institute",
            "lat": 22.28182220459,
            "lon": 73.202598571777
          },
          "contact": {
            "phone": "8686868686"
          },
          "person": {
            "name": "Loren Lpsum"
          }
        },
        "fulfillmentState": "OUT_FOR_DELIVERY",
        "fulfilmentStatusHistory": {
          "SEARCHING_FOR_AGENT": {
            "actual": {
              "endTime": 1722576698000
            }
          },
          "AGENT_ASSIGNED": {
            "actual": {
              "endTime": 1722577843000
            }
          },
          "OUT_FOR_DELIVERY": {
            "actual": {
              "endTime": 1722578383000
            }
          },
          "DELIVERED": {
            "expected": {
              "endTime": 1722581983000
            },
            "promised": {
              "endTime": 1722578383000
            }
          }
        }
      }
    ],
    "quote": {
      "price": {
        "value": 42575
      },
      "breakUp": [
        {
          "referenceId": "OI2401121901140543863671",
          "type": "ITEM",
          "quotationLevel": "ITEM",
          "quantity": {
            "count": 2
          },
          "title": "Hindalco Freshwrapp Aluminium Foil 50 GRAM",
          "price": {
            "value": 42500
          }
        },
        {
          "referenceId": "OF2405200539030657485731",
          "type": "PACKING",
          "quotationLevel": "FULFILLMENT",
          "title": "Packing charges",
          "price": {
            "value": 0
          }
        },
        {
          "referenceId": "OF2401121901140543863862",
          "type": "DELIVERY",
          "quotationLevel": "FULFILLMENT",
          "title": "Delivery charges",
          "price": {
            "value": 70
          }
        },
        {
          "referenceId": "C2407091549138061253438",
          "type": "TAX",
          "quotationLevel": "ORDER",
          "title": "Total Tax",
          "price": {
            "value": 5
          }
        }
      ]
    },
    "actions": [
      {
        "type": "CANCEL_ORDER",
        "channel": "TSP",
        "createdAt": "1732517746206"
      }
    ],
    "createdAt": "2024-02-21T10:41:53.842Z",
    "updatedAt": "2024-02-21T10:41:53.842Z"
  }
}

Error Response:

{
  "requestContext": {
    "requestId": "OMS2402220921362644329327",
    "transactionId": "OD2401121901140533863584"
  },
  "error": {
    "errorCode": "NOT_FOUND",
    "message": "Order id OD2401121901140533863584 not found"
  }
}