Salla Docs
Merchant API
  • Merchant API
  • Salla OAuth 2.0
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • App Functions
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Change Log
Salla CLI
Merchant API
  • Merchant API
  • Salla OAuth 2.0
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • App Functions
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Change Log
Salla CLI
Salla - Opensource
Salla - Developers Community
  1. App Functions
  • Getting Started
  • Setup Shipping App
  • Create Shipping App
  • App Functions
    • Shipment Cancelled
    • Shipment Creating
  • Generating AWB
    • Shipment AWB
    • Shipment Return AWB
    • Shipment Cancelled AWB
  1. App Functions

Shipment Creating

The Shipment Creation function is triggered whenever a new shipment or a return shipment is created. The following app function allows the shipping company to call its API to generate the AWB label, return the tracking link, and provide tracking information. The returned data is then used to update the shipment details inside Salla.

Step By Step Guide#

On Salla Partners Portal, click on "+ Add New Function"
SCR-20251118-jhsx.png
Select the App Function you want to add, which is in this case the Shipment Cancelled Function. After selecting, add a name to the function.

Code Details#

Salla auto-generates starter code, which you can overwrite with the following implementation. This gives a clear place to plug in your shipping logic and connect Salla with the shipping company’s API.
17C40F55-BDDF-4E3A-9B7F-CCD8A87E9A98_1_201_a.jpeg
This flow handles both shipments and return shipments. Shipments use the payload type "shipment", while returns follow the same process with the payload type "return".
Explanation
Full Code
1
Function definition
This function is autogenerated by Salla. It runs when Salla triggers Shipment Creation, receives the context data, and must return a Shipment object.
2
Shipment Company API call
Declares the supported shipment types: a forward shipment or a return shipment. This makes it easier to branch logic later.
3
Build and return final Shipment object
This part is autogenerated by Salla. It builds the final response using Salla’s Shipment builder. All fields are taken from the updated shipmentResponse object and returned to Salla.

Sequence Diagram#

The following diagram shows visually how the shipment creating app function works within Salla Partners Portal:
Modified at 2025-12-08 13:38:12
Previous
Shipment Cancelled
Next
Shipment AWB