Location Partner

All the APIs are in the format:

https://partner.happyreturns.com/API_NAME

Where

  • partner - the partner ID for which the user has logged in
  • API_NAME - the API being called

Authentication Details

Authentication to the Happy Returns API is done by simply adding an HTTP Header to each request. The Header name is always X-Hr-Apikey and the value for the header will be provided during integration for any applicable environments.

Login

Purpose

Login handles authenticating the partner returns app session. The response contains a json web token (JWT) that allows you to open a valid session in browser - using the /rma API.

API Request

POST https://partner.happyreturns.com/login

with a body containing the following:

  • token - string - The authentication token, if already present

  • rma - string - The human-friendly identifier for the transaction

  • locID - string - The Happy Returns ID of the location that hosts the Return Bar where the item was dropped off

  • employid - string - The unique identifier of the employee logging in

      {
          "token": "your-token-id",
          "rma": "HRGDRQP5",
          "locid": "pssjs",
          "employid": "2471665434699"
      }
    

API Response

token - string - The JWT authentication token

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}

Open Return in Browser (rma)

Purpose

This API is used by partners to open the Returns Portal in the browser. An authentication token is required for this API and that can be obtained from the response of the /login API. This API can be successfully called only after getting the response from the /login API.

API Request

GET https://partner.happyreturns.com/rma/RMA_CODE?authorization=JWT_TOKEN

Where

  • RMA_CODE - string - The human-friendly identifier for the transaction; same as the rma value in /login
  • JWT_TOKEN - string - The JWT authentication token; same as the token in the /login response

API Response

Redirects to the webpage in Returns Portal for the specified return

`https://partner.happyreturns.com/rma/RMA_CODE?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9`

Shipment Scheduling

Purpose

This API Creates a Schedule object which initially is just a boolean indicating if a shipment should be created. To create a shipping location for the location, use the Shipping Label API.

API Request

GET https://partner.happyreturns.com/shipments/schedule?location_id=LOC_ID

Where

  • LOC_ID - string - The Happy Returns ID of the location that hosts the Return Bar

      `https://partner.happyreturns.com/shipments/schedule?location_id=pssjs`
    

API Response

  • shouldCreateShipment - bool - The indicator if the shipment for the given location ID should be created or not

      {
          "shouldCreateShipment": "true"
      }
    

Shipping Label

Purpose

Creates and returns the COUNT number of shipping labels requested by the location for their next shipment. The shipping labels should be created after verifying that its a shipping day at the Return Bar.

API request

GET https://partner.happyreturns.com/shipments/labels?location_id=LOC_ID&count=COUNT

Where

  • LOCATION_ID - string - The Happy Returns ID of the location that hosts the Return Bar

  • COUNT - integer - The number of shipping labels being requested

  • HEIGHT - integer - OPTIONAL - The number of DIMENSION_UNITS high the package being shipped is. If WIDTH, DEPTH, and DIMENSION_UNITS are not also provided, a 400 response will be returned.

  • WIDTH - integer - OPTIONAL - The number of DIMENSION_UNITS wide the package being shipped is. If HEIGHT, DEPTH, and DIMENSION_UNITS are not also provided, a 400 response will be returned.

  • DEPTH - integer - OPTIONAL - The number of DIMENSION_UNITS deep the package being shipped is. If HEIGHT, WIDTH, and DIMENSION_UNITS are not also provided, a 400 response will be returned.

  • DIMENSION_UNITS - string - OPTIONAL - The units for the dimensions of the package. This must be one of the following values:

    • IN - Inches
    • CM - Centimeters
  • WEIGHT - number - OPTIONAL - The weight of the package using WEIGHT_UNITS. If WEIGHT_UNITS are not also provided, a 400 response will be returned. Only values out to the hundredth decimal place are supported, any further precision will be truncated.

  • WEIGHT_UNITS - string - OPTIONAL - The units for the weight of the package. This must be one of the following values:

    • LB - Pounds
    • OZ - Ounces
    • KG - Kilograms
    • G - Grams
  • RETURN_BAG_BARCODES - string - OPTIONAL - A comma separated list of the return bag barcodes that will be included in this package.

      https://partner.happyreturns.com/shipments/labels?location_id=pssjs&count=1&height=12&width=6&depth=3&dimension_units=IN&weight=12.5&weight_units=lb&return_bag_barcodes=HR2000000001,HR2000000002,HR2000000003
    

API Response

  • trackingCode - string - The tracking number associated with the shipping label

  • carrier - string - The shipping carrier using which the shipment will be transported

  • contentType - string - Indicates the format of the shipping label, provided by the carrier. Values can be:

    • image/png
    • image/jpeg
    • image/gif
    • application/pdf
    • application/zpl
  • contentBase64 - string - The encoded image of the shipping label, in base64 format

      {
          "trackingCode": "02396343484522319775",
          "carrier": "ups-easpost",
          "contentType": "image/png",
          "contentBase64": "Cl5YQQpeRldOCl5MTDEyMTgKXlBXODEyCl5QT04KXkxI"
      }