Ship API Integration Process
To begin integrating, please follow the steps below:
- Request a partnerID and apiKey for the new integration by contacting Site Flow Support. Once this request is made, HP creates a new shipping method on the PSP Site Flow account and will provide the two values. Notice that charges may apply to the addition of a new integration.
The partnerId can be any name/code used to identify the specific partner integration, e.g. the company name. For example, abcprint can be used for the company named ABC Print.
The apiKey should be a secure random key in hex format. Ideally should be 20 bytes or more. e.g. to generate a new key using node.js: crypto.randomBytes(20).toString("hex"). For example, "012345678901234567890123456789" could be used as an apiKey.
- Locate the new shipping method on the PSP Site Flow account with the newly created shipping method. This new shipping method includes integration fields for partnerID and apiKey.
- Create an HTTPS endpoint that handles the shipment request submitted by Site Flow.
- The following is an example of an endpoint: https://www.endpoint.com/shipment
- The /shipment is added by Site Flow to the endpoint. Please, set up the system to ensure this is supported.
- Add the HTTPS endpoint to the shipping method.
- For more information on the HTTPS endpoint, see the Partner Endpoint section.
- Signed requests are submitted to this HTTPS endpoint when an item is shipped.
- When an item is shipped in Site Flow, the shipping request and shipping method integration fields are forwarded to Site Flow, which does the following:
- Signs the request using the provided partnerId and apiKey
- Forwards the request to the Partner endpoint over HTTPS
- Parses the response from the Partner endpoint
- Verifies the signature on the response from the Partner endpoint
- Returns a correctly formatted response to Site Flow
Ship API Integration Example
An example integration which you should be able to fork and modify and send shipments to is here: https://glitch.com/edit/#!/ofs-shipping
To use the example integration at this endpoint, configure the following fields on your shipping method in Site Flow:
- "endpoint": "https://ofs-shipping.glitch.me",
- "apiKey": "012345678901234567890123456789",
- "partnerId": "abcprint"