trigger.shopify
Module trigger.shopify
API
Definitions
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_trigger.shopify_1.4.1.png)
ballerinax/trigger.shopify Ballerina library
Overview
The Shopify trigger allows you to listen to Shopify webhook notifications. You can use webhook subscriptions to receive notifications about particular events in Shopify shops. After you've subscribed to a webhook topic, your app can execute code immediately after specific events occur in shops that have your app installed, instead of having to make API calls periodically to check their status.
Prerequisites
Before using this trigger in your Ballerina application, complete the following:
- Create a Shopify account
Quickstart
To use the Shopify trigger in your Ballerina application, update the .bal file as follows:
Step 1: Import the trigger
First, import ballerinax/trigger.shopify
module into the Ballerina project as follows.
import ballerinax/trigger.shopify;
Step 2: Create a new trigger instance
Initialize the trigger by providing the Shopify API secret key in the listener config and the port number where your trigger will be running. You can also pass a http:Listener instance instead of the port number with the listener config. The Shopify API secret key is viewable under Webhooks
in the Shopify admin dashboard (if the webhook is created using the dashboard) or under API credentials
in the Shopify App (if the webhook is created programatically).
shopify:ListenerConfig listenerConfig = { apiSecretKey: "<SHOPIFY_API_SECRET_KEY>" }; listener shopify:Listener shopifyListener = new(listenerConfig, 8090);
If you don't provide a port it will use the default port which is 8090.
shopify:ListenerConfig listenerConfig = { apiSecretKey: "<SHOPIFY_API_SECRET_KEY>" }; listener shopify:Listener shopifyListener = new(listenerConfig);
Step 3: Run the trigger service
-
Use the correct service type for the corresponding event channel you are interested, when implementing the service (For example,
shopify:OrdersService
). Now you can implement the trigger remote functions (For example,onOrdersCreate
,onOrdersCancelled
etc) supported under this service type.Following is an example on how to listen to Shopify order events using the Shopify trigger.
service shopify:OrdersService on shopifyListener { remote function onOrdersCreate(shopify:OrderEvent event) returns error? { // Write your logic here } remote function onOrdersCancelled(shopify:OrderEvent event) returns error? { // Write your logic here } remote function onOrdersFulfilled(shopify:OrderEvent event) returns error? { // Write your logic here } remote function onOrdersPaid(shopify:OrderEvent event) returns error? { // Write your logic here } remote function onOrdersPartiallyFulfilled(shopify:OrderEvent event) returns error? { // Write your logic here } remote function onOrdersUpdated(shopify:OrderEvent event) returns error? { // Write your logic here } }
-
Use
bal run
command to compile and run the Ballerina program.
Step 4: Subscribe to a webhook topic with the URL of the service
Subscribe to a webhook topic by following this guide. You can use the createWebhook
operation of the Ballerina Shopify Admin connector to programatically subscribe to a webhook topic. You can also use the Shopify Admin dashboard to manually create a webhook. In your Shopify Admin dashboard, head to Settings > Notifications
and scroll down to Webhooks
to create a new webhook. The ballerina service functions will be triggerred everytime a specific event (that you have subscribed) occurs in the shop that have your Shopify app installed.
Note:
- Locally, you can use ngrok to expose your web service to the internet and to obtain a public URL (For example: 'https://7745640c2478.ngrok.io').
- In Choreo, you can obtain this service URL from the
Invoke URL
section of theConfigure and Deploy
form underDeploy
view before App deployment.- Add a trailing
/
to the end of public URL if it's not present.
Service types![](/images/permalink.svg)
trigger.shopify: OrdersService![](/images/permalink.svg)
Triggers when a new event related to Shopify orders is received. Available actions: onOrdersCreate, onOrdersCancelled, onOrdersFulfilled, onOrdersPaid, onOrdersPartiallyFulfilled, and onOrdersUpdated
onOrdersCreate![](/images/permalink.svg)
function onOrdersCreate(OrderEvent event) returns error?
Parameters
- event OrderEvent -
onOrdersCancelled![](/images/permalink.svg)
function onOrdersCancelled(OrderEvent event) returns error?
Parameters
- event OrderEvent -
onOrdersFulfilled![](/images/permalink.svg)
function onOrdersFulfilled(OrderEvent event) returns error?
Parameters
- event OrderEvent -
onOrdersPaid![](/images/permalink.svg)
function onOrdersPaid(OrderEvent event) returns error?
Parameters
- event OrderEvent -
onOrdersPartiallyFulfilled![](/images/permalink.svg)
function onOrdersPartiallyFulfilled(OrderEvent event) returns error?
Parameters
- event OrderEvent -
onOrdersUpdated![](/images/permalink.svg)
function onOrdersUpdated(OrderEvent event) returns error?
Parameters
- event OrderEvent -
trigger.shopify: CustomersService![](/images/permalink.svg)
Triggers when a new event related to Shopify customers is received. Available actions: onCustomersCreate, onCustomersDisable, onCustomersEnable, onCustomersUpdate, and onCustomersMarketingConsentUpdate
onCustomersCreate![](/images/permalink.svg)
function onCustomersCreate(CustomerEvent event) returns error?
Parameters
- event CustomerEvent -
onCustomersDisable![](/images/permalink.svg)
function onCustomersDisable(CustomerEvent event) returns error?
Parameters
- event CustomerEvent -
onCustomersEnable![](/images/permalink.svg)
function onCustomersEnable(CustomerEvent event) returns error?
Parameters
- event CustomerEvent -
onCustomersUpdate![](/images/permalink.svg)
function onCustomersUpdate(CustomerEvent event) returns error?
Parameters
- event CustomerEvent -
onCustomersMarketingConsentUpdate![](/images/permalink.svg)
function onCustomersMarketingConsentUpdate(CustomerEvent event) returns error?
Parameters
- event CustomerEvent -
trigger.shopify: ProductsService![](/images/permalink.svg)
Triggers when a new event related to Shopify products is received. Available actions: onProductsCreate and onProductsUpdate
onProductsCreate![](/images/permalink.svg)
function onProductsCreate(ProductEvent event) returns error?
Parameters
- event ProductEvent -
onProductsUpdate![](/images/permalink.svg)
function onProductsUpdate(ProductEvent event) returns error?
Parameters
- event ProductEvent -
trigger.shopify: FulfillmentsService![](/images/permalink.svg)
Triggers when a new event related to Shopify fulfillments is received. Available actions: onFulfillmentsCreate and onFulfillmentsUpdate
onFulfillmentsCreate![](/images/permalink.svg)
function onFulfillmentsCreate(FulfillmentEvent event) returns error?
Parameters
- event FulfillmentEvent -
onFulfillmentsUpdate![](/images/permalink.svg)
function onFulfillmentsUpdate(FulfillmentEvent event) returns error?
Parameters
- event FulfillmentEvent -
Listeners![](/images/permalink.svg)
trigger.shopify: Listener![](/images/permalink.svg)
attach![](/images/permalink.svg)
function attach(GenericServiceType serviceRef, () attachPoint) returns error?
detach![](/images/permalink.svg)
function detach(GenericServiceType serviceRef) returns error?
Parameters
- serviceRef GenericServiceType -
'start![](/images/permalink.svg)
function 'start() returns error?
gracefulStop![](/images/permalink.svg)
function gracefulStop() returns error?
immediateStop![](/images/permalink.svg)
function immediateStop() returns error?
Records![](/images/permalink.svg)
trigger.shopify: Address![](/images/permalink.svg)
Fields
- zip string? - The customer's postal code, also known as zip, postcode, Eircode, etc.
- country string? - The customer's country.
- 'address2 string? - An additional field for the customer's mailing address.
- city string? - The customer's city, town, or village.
- 'address1 string? - The customer's mailing address.
- last_name string? - The customer's last name.
- province_code string? - The two-letter code for the customer's region.
- country_code string? - The two-letter country code corresponding to the customer's country.
- 'default boolean? - Returns true for each default address.
- province string? - The customer's region name. Typically a province, a state, or a prefecture.
- phone string? - The customer's phone number at this address.
- country_name string? - The customer's normalized country name.
- name string? - The customer's first and last names.
- company string? - The customer's company.
- id int? - A unique identifier for the address.
- customer_id int? - A unique identifier for the customer.
- first_name string? - The customer's first name.
trigger.shopify: AmountSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: CurrentTotalDutiesSet![](/images/permalink.svg)
Fields
- current_total_duties_set CurrentTotalDutiesSetObject? -
trigger.shopify: CurrentTotalDutiesSetObject![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: Customer![](/images/permalink.svg)
Fields
- note string? - A note about the customer.
- addresses Address[]? - A list of the ten most recently updated addresses for the customer.
- last_order_name string? - The name of the customer's last order. This is directly related to the name field on the Order resource.
- created_at string? - The date and time (ISO 8601 format) when the customer was created.
- multipass_identifier string? - A unique identifier for the customer that's used with Multipass login.
- accepts_marketing_updated_at string? - The date and time (ISO 8601 format) when the customer consented or objected to receiving marketing material by email. Set this value whenever the customer consents or objects to marketing materials.
- default_address Address? -
- updated_at string? - The date and time (ISO 8601 format) when the customer information was last updated.
- accepts_marketing boolean? - Whether the customer has consented to receive marketing material via email.
- currency string? - The three-letter code (ISO 4217 format) for the currency that the customer used when they paid for their last order. Defaults to the shop currency. Returns the shop currency for test orders.
- id int? - A unique identifier for the customer.
- marketing_opt_in_level string? - The marketing subscription opt-in level (as described by the M3AAWG best practices guideline) that the customer gave when they consented to receive marketing material by email. If the customer does not accept email marketing, then this property will be set to null.
- state string? - The state of the customer's account with a shop. Default value is disabled.
- first_name string? - The customer's first name.
- email string? - The unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.
- total_spent string? - The total amount of money that the customer has spent across their order history.
- last_order_id int? - The ID of the customer's last order.
- tax_exempt boolean? - Whether the customer is exempt from paying taxes on their order. If true, then taxes won't be applied to an order at checkout. If false, then taxes will be applied at checkout.
- last_name string? - The customer's last name.
- verified_email boolean? - Whether the customer has verified their email address.
- tags string? - Tags that the shop owner has attached to the customer, formatted as a string of comma-separated values. A customer can have up to 250 tags. Each tag can have up to 255 characters.
- orders_count int? - The number of orders associated with this customer.
- sms_marketing_consent SmsMarketingConsent? -
- metafield Metafield? -
- phone string? - The unique phone number (E.164 format) for this customer. Attempting to assign the same phone number to multiple customers returns an error. The property can be set using different formats, but each format must represent a number that can be dialed from anywhere in the world.
- tax_exemptions string[]? - Whether the customer is exempt from paying specific taxes on their order. Canadian taxes only.
trigger.shopify: CustomerAddress![](/images/permalink.svg)
Fields
- zip string? - The postal code (for example, zip, postcode, or Eircode) of the billing address.
- country string? - The name of the country of the billing address.
- 'address2 string? - An optional additional field for the street address of the billing address.
- city string? - The city, town, or village of the billing address.
- 'address1 string? - The street address of the billing address.
- latitude string? - The latitude of the billing address.
- last_name string? - The last name of the person associated with the payment method.
- province_code string? - The two-letter abbreviation of the region of the billing address.
- country_code string? - The two-letter code (ISO 3166-1 format) for the country of the billing address.
- province string? - The name of the region (for example, province, state, or prefecture) of the billing address.
- phone string? - The phone number at the billing address.
- name string? - The full name of the person associated with the payment method.
- company string? - The company of the person associated with the billing address.
- first_name string? - The first name of the person associated with the payment method.
- longitude string? - The longitude of the billing address.
trigger.shopify: CustomerEvent![](/images/permalink.svg)
Fields
- total_spent string? - The total amount of money that the customer has spent across their order history.
- note string? - A note about the customer.
- addresses Address[]? - A list of the ten most recently updated addresses for the customer.
- last_order_name string? - The name of the customer's last order. This is directly related to the name field on the Order resource.
- last_order_id int? - The ID of the customer's last order.
- tax_exempt boolean? - Whether the customer is exempt from paying taxes on their order. If true, then taxes won't be applied to an order at checkout. If false, then taxes will be applied at checkout.
- created_at string? - The date and time (ISO 8601 format) when the customer was created.
- last_name string? - The customer's last name.
- multipass_identifier string? - A unique identifier for the customer that's used with Multipass login.
- verified_email boolean? - Whether the customer has verified their email address.
- tags string? - Tags that the shop owner has attached to the customer, formatted as a string of comma-separated values. A customer can have up to 250 tags. Each tag can have up to 255 characters.
- accepts_marketing_updated_at string? - The date and time (ISO 8601 format) when the customer consented or objected to receiving marketing material by email. Set this value whenever the customer consents or objects to marketing materials.
- orders_count int? - The number of orders associated with this customer.
- sms_marketing_consent SmsMarketingConsent? -
- updated_at string? - The date and time (ISO 8601 format) when the customer information was last updated.
- accepts_marketing boolean? - Whether the customer has consented to receive marketing material via email.
- phone string? - The unique phone number (E.164 format) for this customer. Attempting to assign the same phone number to multiple customers returns an error. The property can be set using different formats, but each format must represent a number that can be dialed from anywhere in the world.
- admin_graphql_api_id string? - Admin GraphQL API ID
- currency string? - The three-letter code (ISO 4217 format) for the currency that the customer used when they paid for their last order. Defaults to the shop currency. Returns the shop currency for test orders.
- id int? - A unique identifier for the customer.
- state string? - The state of the customer's account with a shop. Default value is disabled.
- marketing_opt_in_level string? - The marketing subscription opt-in level (as described by the M3AAWG best practices guideline) that the customer gave when they consented to receive marketing material by email. If the customer does not accept email marketing, then this property will be set to null.
- first_name string? - The customer's first name.
- email string? - The unique email address of the customer. Attempting to assign the same email address to multiple customers returns an error.
trigger.shopify: DiscountAllocations![](/images/permalink.svg)
Fields
- amount string? - The discount amount allocated to the line in the shop currency.
- discount_application_index int? - The index of the associated discount application in the order's
- amount_set AmountSet? -
trigger.shopify: DiscountApplication![](/images/permalink.svg)
Fields
- allocation_method string? - The method by which the discount application value has been allocated to entitled lines. = ['across', 'each', 'one']
- value_type string? - The type of the value = ['percentage', 'fixed_amount']
- target_type string? - The type of line on the order that the discount is applicable on = ['line_item', 'shipping_line']
- target_selection string? - The lines on the order, of the type defined by target_type, that the discount is allocated over = ['all', 'entitled', 'explicit']
- description string? - The description of the discount application, as defined by the merchant or the Shopify Script. Available only for manual and script discount applications
- 'type string? - The discount application type.Valid values:manual The discount was manually applied by the merchant (for example, by using an app or creating a draft order).script: The discount was applied by a Shopify Script.discount_code: The discount was applied by a discount code. = ['discount_code', 'manual', 'script']
- title string? - The title of the discount application, as defined by the merchant. Available only for manual discount applications
- value string? - The value of the discount application as a decimal. This represents the intention of the discount application
trigger.shopify: DiscountCode![](/images/permalink.svg)
Fields
- amount string? - The value of the discount deducted from the order total. The type field determines how this value is calculated
- code string? - The discount code
- 'type string? - The type of discount. Can be one of: percentage, shipping, fixed_amount (default) = ['fixed_amount', 'percentage', 'shipping']
trigger.shopify: DiscountedPriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: Fulfillment![](/images/permalink.svg)
Fields
- created_at string? - The date and time when the fulfillment was created. The API returns this value in ISO 8601 format
- origin_address Address? -
- line_items LineItem[]? - A historical record of each item in the fulfillment.
- tracking_company string? - The name of the tracking company.
- variant_inventory_management string? - The name of the inventory management service.
- tracking_urls string[]? - The URLs of tracking pages for the fulfillment.
- location_id int? - The unique identifier of the location that the fulfillment should be processed for. To find the ID of the location, use the Location resource.
- updated_at string? - The date and time (ISO 8601 format) when the fulfillment was last modified.
- 'service string? - The type of service used.
- name string? - The uniquely identifying fulfillment name, consisting of two parts separated by a .. The first part represents the order name and the second part represents the fulfillment number. The fulfillment number automatically increments depending on how many fulfillments are in an order (e.g. #1001.1, #1001.2).
- receipt Receipt? -
- id int? - The ID for the fulfillment.
- tracking_numbers string[]? - A list of tracking numbers, provided by the shipping company.
- order_id int? - The unique numeric identifier for the order.
- notify_customer string? - Whether the customer should be notified. If set to true, then an email will be sent when the fulfillment is created or updated. For orders that were initially created using the API, the default value is false. For all other orders, the default value is true.
- shipment_status string? - The current shipment status of the fulfillment.
- status string? - The status of the fulfillment.
trigger.shopify: FulfillmentEvent![](/images/permalink.svg)
Fields
- destination Address? -
- created_at string? - The date and time when the fulfillment was created. The API returns this value in ISO 8601 format
- origin_address Address? -
- tracking_company string? - The name of the tracking company.
- line_items LineItem[]? - A historical record of each item in the fulfillment.
- tracking_urls string[]? - The URLs of tracking pages for the fulfillment.
- location_id int? - The unique identifier of the location that the fulfillment should be processed for. To find the ID of the location, use the Location resource.
- updated_at string? - The date and time (ISO 8601 format) when the fulfillment was last modified.
- 'service string? - The type of service used.
- admin_graphql_api_id string? - Admin GraphQL API ID.
- name string? - The uniquely identifying fulfillment name, consisting of two parts separated by a .. The first part represents the order name and the second part represents the fulfillment number. The fulfillment number automatically increments depending on how many fulfillments are in an order (e.g. #1001.1, #1001.2).
- tracking_number string? - A tracking number, provided by the shipping company.
- receipt Receipt? -
- id int? - The ID for the fulfillment.
- tracking_numbers string[]? - A list of tracking numbers, provided by the shipping company.
- order_id int? - The unique numeric identifier for the order.
- tracking_url string? - The URL of tracking pages for the fulfillment.
- email string? - Email.
- status string? - The status of the fulfillment.
- shipment_status string? - The current shipment status of the fulfillment.
trigger.shopify: LineItem![](/images/permalink.svg)
Fields
- variant_title string? - The title of the product variant being fulfilled.
- quantity int? - The number of items in the fulfillment.
- fulfillable_quantity int? - The amount available to fulfill. This is the quantity - max (refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity.
- total_discount string? - The total of any discounts applied to the line item.
- fulfillment_status string? - The status of an order in terms of the line items being fulfilled. Valid values are fulfilled, null, or partial
- fulfillment_service string? - The service provider who is doing the fulfillment.
- taxable boolean? - Whether the line item is taxable.
- gift_card boolean? - Whether the line item is a gift card
- requires_shipping boolean? - Whether a customer needs to provide a shipping address when placing an order for this product variant.
- fulfillment_line_item_id int? - A unique identifier for a quantity of items within a single fulfillment. An order can have multiple fulfillment line items.
- title string? - The title of the product.
- variant_inventory_management string? - The name of the inventory management system.
- product_exists boolean? - Whether the product exists.
- variant_id int? - The ID of the product variant being fulfilled.
- tax_lines TaxLine[]? - A list of tax line objects, each of which details the title, price, and rate of any taxes applied to the line item.
- price string? - The price of the item.
- vendor string? - The name of the supplier of the item.
- product_id int? - The unique numeric identifier for the product in the fulfillment.
- name string? - The name of the product variant.
- id int? - The ID of the line item within the fulfillment.
- grams int? - The weight of the item in grams.
- sku string? - The unique identifier of the item in the fulfillment.
- properties Property[]? - Any additional properties associated with the line item.
trigger.shopify: ListenerConfig![](/images/permalink.svg)
Fields
- apiSecretKey string -
trigger.shopify: Metafield![](/images/permalink.svg)
Fields
- value_type string - The value type. Valid values are string and integer.
- namespace string - A container for a set of metadata (maximum of 20 characters). Namespaces help distinguish between metadata that you created and metadata created by another individual with a similar namespace.
- description string? - Additional information about the metafield.
- value string - Information to be stored as metadata.
- 'key string - An identifier for the metafield (maximum of 30 characters).
trigger.shopify: NoteAttribute![](/images/permalink.svg)
Fields
- name string? - Name
- value string? - Value
trigger.shopify: Option![](/images/permalink.svg)
Fields
- 'option3 string? - Option 3
- 'option1 string? - Option 1
- 'option2 string? - Option 2
trigger.shopify: OrderAdjustment![](/images/permalink.svg)
Fields
- tax_amount string? - The taxes that are added to amount, such as applicable shipping taxes added to a shipping refund.
- reason string? - The reason for the order adjustment. To set this value, include discrepancy_reason when you create a refund.
- amount string? - The value of the discrepancy between the calculated refund and the actual refund. If the kind property's value is shipping_refund, then amount returns the value of shipping charges refunded to the customer.
- kind string? - The order adjustment type. Valid values are shipping_refund and refund_discrepancy.
- id int? - The unique identifier for the order adjustment.
- order_id int? - The unique identifier for the order that the order adjustment is associated with.
- refund_id int? - The unique identifier for the refund that the order adjustment is associated with.
trigger.shopify: OrderEvent![](/images/permalink.svg)
Fields
- cancelled_at string? - The date and time when the order was canceled. Returns null if the order isn't canceled.
- fulfillment_status string? - The order's status in terms of fulfilled line items.
- total_price_usd string? - The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. Must be positive.
- billing_address CustomerAddress? -
- line_items OrderLineItem[]? - A list of line item objects, each containing information about an item in the order.
- presentment_currency string? - The presentment currency that was used to display prices to the customer.
- total_discounts_set TotalDiscountsSet? -
- original_total_duties_set OriginalTotalDutiesSet? -
- location_id int? - The ID of the physical location where the order was processed. If you need to reference the location against an order, then use the FulfillmentOrder resource.
- source_url string? - The source url
- landing_site string? - The URL for the page where the buyer landed when they entered the shop.
- source_identifier string? - The source identifier
- reference string? - The reference where the customer clicked a link to the shop.
- number int? - The order's position in the shop's count of orders. Numbers are sequential and start at 1.
- checkout_token string? - A unique value when referencing the checkout that's associated with the order.
- tax_lines TaxLine[]? - An array of tax line objects, each of which details a tax applicable to the order. When creating an order through the API, tax lines can be specified on the order or the line items but not both. Tax lines specified on the order are split across the taxable line items in the created order.
- customer_locale string? - The two or three-letter language code, optionally followed by a region modifier.
- id int? - The ID of the order, used for API purposes. This is different from the order_number property, which is the ID used by the shop owner and customer.
- app_id int? - The ID of the app that created the order.
- subtotal_price string? - The price of the order in the shop currency after discounts but before shipping, duties, taxes, and tips.
- closed_at string? - The date and time (ISO 8601 format) when the order was closed. Returns null if the order isn't closed.
- order_status_url string? - The URL pointing to the order status web page, if applicable.
- test boolean? - Whether this is a test order.
- device_id int? - The device ID
- total_shipping_price_set TotalShippingPriceSet? -
- subtotal_price_set SubtotalPriceSet? -
- payment_gateway_names string[]? - The list of payment gateways used for the order.
- total_tax string? - The sum of all the taxes applied to the order in the shop currency. Must be positive.
- tags string? - Tags attached to the order, formatted as a string of comma-separated values. Tags are additional short descriptors, commonly used for filtering and searching. Each individual tag is limited to 40 characters in length.
- processing_method string? - How the payment was processed. It has the following valid values
- shipping_lines ShippingLine[]? - An array of objects, each of which details a shipping method used.
- user_id int? - The ID of the user logged into Shopify POS who processed the order, if applicable.
- phone string? - The customer's phone number for receiving SMS notifications.
- note_attributes NoteAttribute[]? - Extra information that is added to the order. Appears in the Additional details section of an order details page. Each array entry must contain a hash with name and value keys.
- name string? - The order name, generated by combining the order_number property with the order prefix and suffix that are set in the merchant's general settings. This is different from the id property, which is the ID of the order used by the API. This field can also be set by the API to be any string value.
- cart_token string? - A unique value when referencing the cart that's associated with the order.
- total_tax_set TotalTaxSet? -
- landing_site_ref string? - The URL for the page where the buyer landed when they entered the shop.
- discount_codes DiscountCode[]? - A list of discounts applied to the order.
- note string? - An optional note that a shop owner can attach to the order.
- order_number int? - The order 's position in the shop's count of orders starting at 1001. Order numbers are sequential and start at 1001.
- discount_applications DiscountApplication[]? - An ordered list of stacked discount applications.
- created_at string? - The autogenerated date and time (ISO 8601 format) when the order was created in Shopify. The value for this property cannot be changed.
- total_line_items_price_set TotalLineItemsPriceSet? -
- taxes_included boolean? - Whether taxes are included in the order subtotal.
- buyer_accepts_marketing boolean? - Whether the customer consented to receive email updates from the shop.
- payment_terms PaymentTerms? -
- confirmed boolean? - Confirmation status
- total_weight decimal? - The sum of all line item weights in grams. The sum is not adjusted as items are removed from the order.
- contact_email string? - The contact email address.
- refunds Refund[]? - A list of refunds applied to the order. For more information, see the Refund API.
- total_discounts string? - The total discounts applied to the price of the order in the shop currency.
- fulfillments Fulfillment[]? - An array of fulfillments associated with the order. For more information, see the Fulfillment API.
- updated_at string? - The date and time (ISO 8601 format) when the order was last modified. Filtering orders by updated_at is not an effective method for fetching orders because its value can change when no visible fields of an order have been updated. Use the Webhook and Event APIs to subscribe to order events instead.
- referring_site string? - The website where the customer clicked a link to the shop.
- processed_at string? - The date and time (ISO 8601 format) when an order was processed. This value is the date that appears on your orders and that's used in the analytic reports. If you're importing orders from an app or another platform, then you can set processed_at to a date and time in the past to match when the original order was created.
- currency string? - The three-letter code (ISO 4217 format) for the shop currency.
- shipping_address CustomerAddress? -
- email string? - The customer's email address.
- browser_ip string? - The IP address of the browser used by the customer when they placed the order. Both IPv4 and IPv6 are supported.
- source_name string? - Where the order originated. Can be set only during order creation, and is not writeable afterwards. Values for Shopify channels are protected and cannot be assigned by other API clients: web, pos, shopify_draft_order, iphone, and android. Orders created via the API can be assigned any other string of your choice. If unspecified, then new orders are assigned the value of your app's ID.
- total_price_set TotalPriceSet? -
- total_price string? - The sum of all line item prices, discounts, shipping, taxes, and tips in the shop currency. Must be positive.
- current_total_duties_set CurrentTotalDutiesSet? -
- total_line_items_price string? - The sum of all line item prices in the shop currency.
- total_tip_received string? - The sum of all the tips in the order in the shop currency.
- token string? - A unique value when referencing the order.
- cancel_reason string? - The reason why the order was canceled.
- financial_status string? - The status of payments associated with the order. Can only be set when the order is created.
- admin_graphql_api_id string? - Admin GraphQL API ID.
- gateway string? - The payment gateway used.
- customer Customer? -
trigger.shopify: OrderLineItem![](/images/permalink.svg)
Fields
- variant_title string? - The title of the product variant being fulfilled.
- origin_location Address? -
- total_discount string? - The total of any discounts applied to the line item.
- fulfillment_status string? - The status of an order in terms of the line items being fulfilled. Valid values are fulfilled, null, or partial
- gift_card boolean? - Whether the line item is a gift card
- requires_shipping boolean? - Whether a customer needs to provide a shipping address when placing an order for this product variant.
- fulfillment_line_item_id int? - A unique identifier for a quantity of items within a single fulfillment. An order can have multiple fulfillment line items.
- total_discount_set TotalDiscountSet? -
- title string? - The title of the product.
- tip_payment_gateway string? - The payment gateway used to tender the tip, such as shopify_payments. Present only on tips
- product_exists boolean? - Whether the product exists.
- variant_id int? - The ID of the product variant being fulfilled.
- tax_lines TaxLine[]? - A list of tax line objects, each of which details a tax applied to the item.
- vendor string? - The name of the supplier of the item.
- price string? - The price of the item.
- product_id int? - The unique numeric identifier for the product in the fulfillment.
- id int? - The ID of the line item within the fulfillment.
- sku string? - The unique identifier of the item in the fulfillment.
- grams int? - The weight of the item in grams.
- quantity int? - The number of items in the fulfillment.
- fulfillable_quantity int? - The amount available to fulfill. This is the quantity - max (refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity.
- fulfillment_service string? - The service provider who is doing the fulfillment.
- taxable boolean? - Whether the line item is taxable.
- variant_inventory_management string? - The name of the inventory management system.
- discount_allocations DiscountAllocations[]? - An ordered list of amounts allocated by discount applications. Each discount allocation is associated with a particular discount application.
- tip_payment_method string? - The payment method used to tender the tip, such as Visa. Present only on tips.
- admin_graphql_api_id string? - Admin GraphQL API ID
- name string? - The name of the product variant.
- price_set PriceSet? -
- properties Property[]? - Any additional properties associated with the line item.
trigger.shopify: OriginalTotalDutiesSet![](/images/permalink.svg)
Fields
- original_total_duties_set OriginalTotalDutiesSetObject? -
trigger.shopify: OriginalTotalDutiesSetObject![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: PaymentSchedule![](/images/permalink.svg)
Fields
- completed_at string? - The date and time when the purchase is completed. Returns null initially and updates when the payment is captured.
- amount string? - The amount that is owed according to the payment terms.
- expected_payment_method string? - The name of the payment method gateway.
- currency string? - The presentment currency for the payment.
- due_at string? - The date and time when the payment is due. Calculated based on issued_at and due_in_days or a customized fixed date if the type is fixed.
- issued_at string? - The date and time when the payment terms were initiated.
trigger.shopify: PaymentTerms![](/images/permalink.svg)
Fields
- payment_terms_type string? - The type of selected payment terms template for the order.
- amount string? - The amount that is owed according to the payment terms.
- payment_terms_name string? - The name of the selected payment terms template for the order.
- due_in_days int? - The number of days between the invoice date and due date that is defined in the selected payment terms template.
- currency string? - The presentment currency for the payment.
- payment_schedules PaymentSchedule[]? - An array of schedules associated to the payment terms.
trigger.shopify: PresentmentPrice![](/images/permalink.svg)
Fields
- compare_at_price Price? -
- price Price? -
trigger.shopify: PresentmentPrices![](/images/permalink.svg)
Fields
- presentment_prices PresentmentPrice[]? - A list of the variant's presentment prices and compare-at prices in each of the shop's enabled presentment currencies.
trigger.shopify: Price![](/images/permalink.svg)
Fields
- amount string? - The variant's price or compare-at price in the presentment currency.
- currency_code string? - The three-letter code (ISO 4217 format) for one of the shop's enabled presentment currencies.
trigger.shopify: PriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: ProductEvent![](/images/permalink.svg)
Fields
- body_html string? - A description of the product. Supports HTML formatting.
- images ProductImage[]? - A list of product image objects, each one representing an image associated with the product.
- created_at string? - The date and time (ISO 8601 format) when the product was created.
- 'handle string? - A unique human-friendly string for the product. Automatically generated from the product's title. Used by the Liquid templating language to refer to objects.
- variants ProductVariant[]? - An array of product variants, each representing a different version of the product. The position property is read-only. The position of variants is indicated by the order in which they are listed.
- title string? - The name of the product.
- tags string? - A string of comma-separated tags that are used for filtering and search. A product can have up to 250 tags. Each tag can have up to 255 characters.
- published_scope string? - Whether the product is published to the Point of Sale channel.
- product_type string? - A categorization for the product used for filtering and searching products.
- template_suffix string? - The suffix of the Liquid template used for the product page. If this property is specified, then the product page uses a template called "product.suffix.liquid", where "suffix" is the value of this property. If this property is "" or null, then the product page uses the default template "product.liquid". (default is null)
- updated_at string? - The date and time (ISO 8601 format) when the product was last modified. A product's updated_at value can change for different reasons. For example, if an order is placed for a product that has inventory tracking set up, then the inventory adjustment is counted as an update.
- vendor string? - The name of the product's vendor.
- admin_graphql_api_id string? - Admin GraphQL API ID
- options ProductOption[]? - The custom product properties. For example, Size, Color, and Material. Each product can have up to 3 options and each option value can be up to 255 characters. Product variants are made of up combinations of option values. Options cannot be created without values. To create new options, a variant with an associated option value also needs to be created.
- id int? - An unsigned 64-bit integer that's used as a unique identifier for the product. Each id is unique across the Shopify system. No two products will have the same id, even if they're from different shops.
- published_at string? - The date and time (ISO 8601 format) when the product was published. Can be set to null to unpublish the product from the Online Store channel.
- status string? - The status of the product.
trigger.shopify: ProductImage![](/images/permalink.svg)
Fields
- updated_at string? - The date and time when the product image was last modified. The API returns this value in ISO 8601 format.
- src string? - Specifies the location of the product image. This parameter supports URL filters that you can use to retrieve modified copies of the image. For example, add _small, to the filename to retrieve a scaled copy of the image at 100 x 100 px (for example, ipod-nano_small.png), or add _2048x2048 to retrieve a copy of the image constrained at 2048 x 2048 px resolution (for example, ipod-nano_2048x2048.png).
- product_id int? - The id of the product associated with the image.
- admin_graphql_api_id string? - Admin GraphQL API ID.
- width int? - Width dimension of the image which is determined on upload.
- created_at string? - The date and time when the product image was created. The API returns this value in ISO 8601 formatting.
- variant_ids int[]? - An array of variant ids associated with the image.
- id int? - A unique numeric identifier for the product image.
- position int? - The order of the product image in the list. The first product image is at position 1 and is the "main" image for the product.
- height int? - Height dimension of the image which is determined on upload.
trigger.shopify: ProductOption![](/images/permalink.svg)
Fields
- product_id int? - Product option product ID
- values string[]? - Product option values
- name string? - Product option name
- id int? - Product option ID
- position int? - Product option position
trigger.shopify: ProductVariant![](/images/permalink.svg)
Fields
- presentment_prices PresentmentPrices? -
- inventory_management string? - The fulfillment service that tracks the number of items in stock for the product variant.
- old_inventory_quantity int? - This property is deprecated. Use the InventoryLevel resource instead.
- requires_shipping boolean? - This property is deprecated. Use the
requires_shipping
property on the InventoryItem resource instead.
- created_at string? - The date and time (ISO 8601 format) when the product variant was created.
- title string? - The title of the product variant. The title field is a concatenation of the option1, option2, and option3 fields. You can only update title indirectly using the option fields.
- inventory_quantity_adjustment int? - This property is deprecated. Use the InventoryLevel resource instead.
- updated_at string? - The date and time when the product variant was last modified. Gets returned in ISO 8601 formatting.
- inventory_item_id int? - The unique identifier for the inventory item, which is used in the Inventory API to query for inventory information.
- price string? - The price of the product variant.
- product_id int? - The unique numeric identifier for the product.
- id int? - The unique numeric identifier for the product variant.
- grams int? - The weight of the product variant in grams.
- sku string? - A unique identifier for the product variant in the shop. Required in order to connect to a FulfillmentService.
- barcode string? - The barcode, UPC, or ISBN number for the product.
- inventory_quantity int? - An aggregate of inventory across all locations. To adjust inventory at a specific location, use the InventoryLevel resource.
- compare_at_price string? - The original price of the item before an adjustment or a sale.
- fulfillment_service string? - The fulfillment service associated with the product variant. Valid values are manual or the handle of a fulfillment service.
- taxable boolean? - Whether a tax is charged when the product variant is sold.
- weight int? - The weight of the product variant in the unit system specified with weight_unit.
- inventory_policy string? - Whether customers are allowed to place an order for the product variant when it's out of stock.
- tax_code string? - This parameter applies only to the stores that have the Avalara AvaTax app installed. Specifies the Avalara tax code for the product variant.
- weight_unit string? - The unit of measurement that applies to the product variant's weight. If you don't specify a value for weight_unit, then the shop's default unit of measurement is applied. Valid values are g, kg, oz, and lb.
- position int? - The order of the product variant in the list of product variants. The first position in the list is 1. The position of variants is indicated by the order in which they are listed.
- image_id int? - The unique numeric identifier for a product's image. The image must be associated to the same product as the variant.
- option Option? -
trigger.shopify: Property![](/images/permalink.svg)
Fields
- name string? - Property name
- value string? - Property value
trigger.shopify: Receipt![](/images/permalink.svg)
Fields
- authorization string? - The authorization code.
- testcase boolean? - Whether the fulfillment was a testcase.
trigger.shopify: Refund![](/images/permalink.svg)
Fields
- note string? - An optional note attached to a refund.
- refund_line_items RefundLineItem[]? - A list of refunded line items.
- user_id int? - The unique identifier of the user who performed the refund.
- order_adjustments OrderAdjustment[]? - A list of order adjustments attached to the refund. Order adjustments are generated to account for refunded shipping costs and differences between calculated and actual refund amounts.
- created_at string? - The date and time (ISO 8601 format) when the refund was created.
- processed_at string? - The date and time (ISO 8601 format) when the refund was imported. This value can be set to a date in the past when importing from other systems. If no value is provided, then it will be auto-generated as the current time in Shopify. Public apps need to be granted permission by Shopify to import orders with the processed_at timestamp set to a value earlier the created_at timestamp. Private apps can't be granted permission by Shopify.
- id int? - The unique identifier for the refund.
trigger.shopify: RefundLineItem![](/images/permalink.svg)
Fields
- line_item_id int? - The ID of the related line item in the order.
- quantity int? - The quantity of the associated line item that was returned.
- subtotal decimal? - The subtotal of the refund line item.
- id int? - The unique identifier of the line item in the refund.
- total_tax decimal? - The total tax on the refund line item.
- location_id int? - The unique identifier of the location where the items will be restocked. Required when restock_type has the value return or cancel.
- restock_type string? - How this refund line item affects inventory levels.
trigger.shopify: ShippingLine![](/images/permalink.svg)
Fields
- code string? - A reference to the shipping method.
- price string? - The price of this shipping method in the shop currency. Can't be negative.
- 'source string? - The source of the shipping method.
- price_set PriceSet? -
- title string? - The title of the shipping method.
- carrier_identifier string? - A reference to the carrier service that provided the rate. Present when the rate was computed by a third-party carrier service.
- discounted_price_set DiscountedPriceSet? -
- discounted_price string? - The price of the shipping method after line-level discounts have been applied. Doesn't reflect cart-level or order-level discounts.
- requested_fulfillment_service_id string? - A reference to the fulfillment service that is being requested for the shipping method. Present if the shipping method requires processing by a third party fulfillment service; null otherwise.
trigger.shopify: SmsMarketingConsent![](/images/permalink.svg)
Fields
- consent_updated_at string? - The date and time at which the customer consented to receive marketing material by SMS. The customer's consent state reflects the consent record with the most recent last_consent_updated_at date. If no date is provided, then the date and time at which the consent information was sent is used.
- consent_collected_from string? - The source for whether the customer has consented to receive marketing material by SMS.
- state string? - The current SMS marketing state for the customer.
- opt_in_level string? - The marketing subscription opt-in level, as described by the M3AAWG best practices guidelines, that the customer gave when they consented to receive marketing material by SMS.
trigger.shopify: SubtotalPriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TaxLine![](/images/permalink.svg)
Fields
- channel_liable boolean? - Whether the channel that submitted the tax line is liable for remitting. A value of null indicates unknown liability for the tax line.
- rate decimal? - The rate of tax to be applied.
- price string? - The amount of tax to be charged in the shop currency.
- title string? - The name of the tax.
trigger.shopify: TotalDiscountSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TotalDiscountsSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TotalLineItemsPriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TotalPriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TotalShippingPriceSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
trigger.shopify: TotalTaxSet![](/images/permalink.svg)
Fields
- shop_money Price? -
- presentment_money Price? -
Union types![](/images/permalink.svg)
trigger.shopify: GenericDataType![](/images/permalink.svg)
GenericDataType
trigger.shopify: GenericServiceType![](/images/permalink.svg)
GenericServiceType
Import
import ballerinax/trigger.shopify;
Metadata
Released date: about 1 year ago
Version: 1.4.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.7.1
GraalVM compatible: Yes
Pull count
Total: 137
Current verison: 10
Weekly downloads
Keywords
Commerce/eCommerce
Cost/Paid
Trigger
Contributors
Dependencies