### Include Delivery Gateway SDK (JavaScript) Source: https://docs.deliverygateway.io/dev/getting-started/get-started This script tag includes the Delivery Gateway SDK, enabling frontend integrations. It should be added to your website's HTML. The script loads asynchronously and makes the DGW object available globally. ```html ``` -------------------------------- ### Configure and Mount Delivery Gateway Widget (JavaScript) Source: https://docs.deliverygateway.io/dev/getting-started/get-started This JavaScript code configures and mounts the Delivery Gateway widget for delivery method selection on your website. It defines a callback function that is executed once the DGW object is loaded, passing the DGW object as an argument. This function then calls the `mount` method with specific configuration options. ```javascript function deliveryMethodSelector(DGW) { DGW.mount({ containerId: "delivery-gateway", merchantId: "5441a8c6-5dfb-4744-b6ae-f0d221d4718c", view: { type: "delivery-method-selection", openSelectedMethodInModal: true, operatorsAsSeparateMethods: true, }, }); } if (window.DGW) { deliveryMethodSelector(window.DGW); } else { window.DGWOnLoad = deliveryMethodSelector; } ``` -------------------------------- ### Get Pricing Query Source: https://docs.deliverygateway.io/api/merchant/types/objects/pricing Retrieves a specific pricing configuration by its ID. It returns the pricing object if found. ```APIDOC ## POST /graphql ### Description Retrieves a specific pricing configuration by its ID. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters None #### Request Body - **query** (String!) - The GraphQL query string. - **variables** (Object) - Variables for the GraphQL query. ### Request Example ```json { "query": "query GetPricing($id: ID!) { pricing(id: $id) { id name condition { ... } price { ... } priority } }", "variables": { "id": "pricing-123" } } ``` ### Response #### Success Response (200) - **data** (Object) - Contains the result of the query. - **pricing** (Pricing) - The requested pricing object, or null if not found. #### Response Example ```json { "data": { "pricing": { "id": "pricing-123", "name": "Standard Price", "condition": { "field": "country", "operator": "EQUALS", "value": "US" }, "price": { "amount": 1000, "currency": "USD" }, "priority": 1 } } } ``` ``` -------------------------------- ### GET /themes Source: https://docs.deliverygateway.io/api/merchant/operations/queries/themes Retrieves a paginated list of themes. You can specify the number of themes to fetch and the page number. ```APIDOC ## GET /themes ### Description Retrieves a paginated list of themes. You can specify the number of themes to fetch and the page number. ### Method GET ### Endpoint /themes ### Parameters #### Query Parameters - **first** (Int!) - Required - Limits number of fetched items. - **page** (Int) - Optional - The offset from which items are returned. ### Response #### Success Response (200) - **ThemePaginator** (object) - A paginated list of Theme items. #### Response Example { "data": [ { "id": "theme1", "name": "Default Theme" }, { "id": "theme2", "name": "Dark Mode Theme" } ], "pagination": { "currentPage": 1, "totalPages": 5, "totalItems": 50 } } ``` -------------------------------- ### Get Packaging Query Source: https://docs.deliverygateway.io/api/merchant/types/objects/packaging Retrieves a specific packaging by its ID or handle. ```APIDOC ## POST /graphql ### Description Retrieves a specific packaging by its ID or handle. ### Method POST ### Endpoint /graphql ### Query Parameters - **id** (ID) - The ID of the packaging to retrieve. - **handle** (ID) - The handle of the packaging to retrieve. ### Request Example ```json { "query": "query GetPackaging($id: ID) { packaging(id: $id) { id name handle dimensions { length width height unit } isDefault } }", "variables": { "id": "pkg_abc123" } } ``` ### Response #### Success Response (200) - **data.packaging** (Packaging) - The requested Packaging object, or null if not found. - **id** (ID!) - Unique identifier for the packaging. - **name** (String!) - The name of the packaging. - **handle** (ID!) - A unique handle for the packaging. - **dimensions** (Dimension!) - The dimensions of the packaging. - **isDefault** (Boolean!) - Indicates if this is the default packaging. #### Response Example ```json { "data": { "packaging": { "id": "pkg_abc123", "name": "Box Medium", "handle": "box-medium", "dimensions": { "length": 30, "width": 20, "height": 10, "unit": "cm" }, "isDefault": false } } } ``` ``` -------------------------------- ### Modify Data with GraphQL Mutations Source: https://docs.deliverygateway.io/dev/getting-started/graphql Shows how to create or update resources using mutations. The example creates a delivery zone and specifies the fields to return in the response. ```graphql mutation { createZone( input: { name: "Hungary", countries: HU } ) { id name countries } } ``` ```json { "data": { "createZone": { "id": "45678", "name": "Hungary", "countries": [ "HU" ] } } } ``` -------------------------------- ### Get Packaging by ID Source: https://docs.deliverygateway.io/api/merchant/operations/queries/packaging Retrieves detailed information about a specific packaging using its unique ID. ```APIDOC ## GET /websites/deliverygateway_io/packaging ### Description Retrieves detailed information about a specific packaging using its unique ID. ### Method GET ### Endpoint `/websites/deliverygateway_io/packaging` ### Parameters #### Query Parameters - **id** (ID!) - Required - The unique identifier for the packaging. ### Request Example ```json { "query": "query GetPackaging($id: ID!) { packaging(id: $id) { ... } }", "variables": { "id": "your_packaging_id" } } ``` ### Response #### Success Response (200) - **packaging** (Packaging) - The packaging object containing details. #### Response Example ```json { "data": { "packaging": { "id": "example_id", "name": "Example Packaging", "description": "This is an example packaging." } } } ``` ``` -------------------------------- ### Get Pricings Source: https://docs.deliverygateway.io/api/merchant/operations/queries/pricings Retrieves a paginated list of pricing items. You can specify the number of items per page and the page number. ```APIDOC ## GET /websites/deliverygateway_io/pricings ### Description Retrieves a paginated list of pricing items. You can specify the number of items per page and the page number. ### Method GET ### Endpoint /websites/deliverygateway_io/pricings ### Parameters #### Query Parameters - **first** (Int!) - Required - Limits number of fetched items. - **page** (Int) - Optional - The offset from which items are returned. ### Request Example ```json { "query": "query GetPricings($first: Int!, $page: Int) { pricings(first: $first, page: $page) { ...PricingPaginatorFields } }\n\nfragment PricingPaginatorFields on PricingPaginator {\n # Add fields for PricingPaginator here\n}" } ``` ### Response #### Success Response (200) - **PricingPaginator** (object) - A paginated list of Pricing items. #### Response Example ```json { "data": { "pricings": { "#typename": "PricingPaginator", "items": [ { "#typename": "Pricing", "id": "price_123", "name": "Basic Plan", "price": 10.00, "currency": "USD" } ], "hasNextPage": true, "endCursor": "cursor_abc" } } } ``` ``` -------------------------------- ### Create Custom Pickup Point with GraphQL Source: https://docs.deliverygateway.io/dev/how-tos/create-custom-pickup-point Demonstrates the step-by-step construction of the createPickupPoint mutation. It covers basic identity fields, address structures, geolocation coordinates, activation flags, and complex opening hours configurations. ```GraphQL mutation { createPickupPoint( input: { referenceId: "123abc", name: "My Store", phone: "01 234 5678", address: { country: HU, city: "Budapest", postalCode: "1061", addressLine1: "Nyugati tér 1." }, location: { latitude: 47.50969187518572, longitude: 19.05571832644608 }, isActive: true, openingHours: { timezone: EUROPE_BUDAPEST, openingHours: [ { day: MONDAY, start: { hour: 8, minute: 0 }, end: { hour: 17, minute: 0 } }, { day: TUESDAY, start: { hour: 9, minute: 0 }, end: { hour: 18, minute: 0 } } ] } } ) } ``` -------------------------------- ### List All Merchant Configurations using GraphQL Source: https://docs.deliverygateway.io/dev/concepts/merchant Shows how to retrieve a comprehensive list of all merchant configuration options, including their keys, descriptions, current values, and default values. ```graphql query { me { configurations { key description value default } } } ``` ```json { "data": { "me": { "configurations": [ { "key": "UI_ALLOWED_REFERRERS", "description": "Allowed HTTP referrers for embedded UI", "value": "", "default": null }, { "key": "SENDER_NAME", "description": "Default sender name for shipments", "value": "Ny Shop's Name", "default": null } ] } } } ``` -------------------------------- ### GET /providers Source: https://docs.deliverygateway.io/dev/concepts/providers Retrieve a list of all available logistics providers and their basic status information. ```APIDOC ## GET /providers ### Description Fetches a list of all logistics providers enabled for the merchant, including their ID, name, and availability status. ### Method POST (GraphQL Query) ### Endpoint /graphql ### Request Example ```graphql query { providers { id name icon isEnabled isAvailable } } ``` ### Response #### Success Response (200) - **data** (Object) - The root response object - **providers** (Array) - List of provider objects #### Response Example ```json { "data": { "providers": [ { "id": "Best Prov Inc" }, { "id": "Second Best Prov Inc" } ] } } ``` ``` -------------------------------- ### Create Pricing Mutation Source: https://docs.deliverygateway.io/api/merchant/types/objects/pricing Allows the creation of a new pricing configuration. It takes pricing details as input and returns the created pricing object. ```APIDOC ## POST /graphql ### Description Creates a new pricing configuration. ### Method POST ### Endpoint /graphql ### Parameters #### Query Parameters None #### Request Body - **query** (String!) - The GraphQL query string. - **variables** (Object) - Variables for the GraphQL query. ### Request Example ```json { "query": "mutation CreatePricing($input: CreatePricingInput!) { createPricing(input: $input) { id name condition { ... } price { ... } priority } }", "variables": { "input": { "name": "Standard Price", "condition": { "field": "country", "operator": "EQUALS", "value": "US" }, "price": { "amount": 1000, "currency": "USD" }, "priority": 1 } } } ``` ### Response #### Success Response (200) - **data** (Object) - Contains the result of the mutation. - **createPricing** (Pricing) - The newly created pricing object. #### Response Example ```json { "data": { "createPricing": { "id": "pricing-123", "name": "Standard Price", "condition": { "field": "country", "operator": "EQUALS", "value": "US" }, "price": { "amount": 1000, "currency": "USD" }, "priority": 1 } } } ``` ``` -------------------------------- ### POST /session Source: https://docs.deliverygateway.io/api/merchant/operations/mutations/session Initializes a new session by accepting a SessionInput object and returning a Session object. ```APIDOC ## POST /session ### Description Initializes a new session for the delivery gateway. ### Method POST ### Endpoint /session ### Parameters #### Request Body - **input** (SessionInput) - Required - The session configuration object. ### Request Example { "input": { "sessionId": "example-id" } } ### Response #### Success Response (200) - **session** (Session) - The initialized session object. #### Response Example { "session": { "id": "12345", "status": "active" } } ``` -------------------------------- ### GET /zones Source: https://docs.deliverygateway.io/api/merchant/operations/queries/zones Retrieves a paginated list of zones. You can specify the number of items to fetch and the page number. ```APIDOC ## GET /zones ### Description Retrieves a paginated list of zones. You can specify the number of items to fetch and the page number. ### Method GET ### Endpoint /zones ### Parameters #### Query Parameters - **first** (Int!) - Required - Limits the number of fetched items. - **page** (Int) - Optional - The offset from which items are returned. ### Response #### Success Response (200) - **ZonePaginator** (object) - A paginated list of Zone items. #### Response Example ```json { "data": [ { "id": "zone1", "name": "Zone A" }, { "id": "zone2", "name": "Zone B" } ], "pagination": { "total": 100, "page": 1, "first": 10 } } ``` ``` -------------------------------- ### POST /graphql (createWebhook) Source: https://docs.deliverygateway.io/api/merchant/operations/mutations/create-webhook Registers a new webhook by providing the required CreateWebhookInput object. ```APIDOC ## POST /graphql ### Description Creates a new webhook instance in the system. This mutation requires a non-null CreateWebhookInput object. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **input** (CreateWebhookInput!) - Required - The input object containing webhook configuration details. ### Request Example { "query": "mutation { createWebhook(input: { url: \"https://example.com/webhook\", events: [\"order.created\"] }) { id url } }" } ### Response #### Success Response (200) - **Webhook** (Object) - The created webhook object. #### Response Example { "data": { "createWebhook": { "id": "wh_12345", "url": "https://example.com/webhook" } } } ``` -------------------------------- ### POST /createPickupPoint Source: https://docs.deliverygateway.io/api/merchant/operations/mutations/create-pickup-point Mutation to create a new pickup point in the delivery network. ```APIDOC ## POST /createPickupPoint ### Description Creates a new pickup point entity based on the provided input object. ### Method POST ### Endpoint /createPickupPoint ### Parameters #### Request Body - **input** (CreatePickupPointInput!) - Required - The input object containing details for the new pickup point. ### Request Example { "query": "mutation { createPickupPoint(input: { name: \"Main Hub\", address: \"123 Delivery St\" }) { id name } }" } ### Response #### Success Response (200) - **PickupPoint** (Object) - Returns the created pickup point object. #### Response Example { "data": { "createPickupPoint": { "id": "pp_12345", "name": "Main Hub" } } } ``` -------------------------------- ### GET /pickupPoints Source: https://docs.deliverygateway.io/api/merchant/operations/queries/pickup-points Retrieves a paginated list of pickup points. You can filter and sort the results using the provided arguments. ```APIDOC ## GET /pickupPoints ### Description Retrieves a paginated list of pickup points. You can filter and sort the results using the provided arguments. ### Method GET ### Endpoint /pickupPoints ### Parameters #### Query Parameters - **filters** (PickupPointFilterInput) - Optional - Filters for pickup points. - **sortBy** (PickupPointSortInput) - Optional - Sort order for pickup points. - **first** (Int!) - Required - Limits the number of fetched items. - **page** (Int) - Optional - The offset from which items are returned. ### Request Example ```json { "filters": { ... }, "sortBy": { ... }, "first": 10, "page": 1 } ``` ### Response #### Success Response (200) - **PickupPointPaginator** (object) - A paginated list of PickupPoint items. #### Response Example ```json { "data": [ { "id": "pickup-point-1", "name": "Main Street Location", "address": "123 Main St, Anytown, USA" }, { "id": "pickup-point-2", "name": "Downtown Hub", "address": "456 Downtown Ave, Anytown, USA" } ], "pagination": { "total": 50, "first": 10, "page": 1, "hasNextPage": true } } ``` ``` -------------------------------- ### Executing Multiple Mutations with Aliases Source: https://docs.deliverygateway.io/dev/getting-started/graphql Illustrates how to run multiple mutations in a single request by assigning custom aliases to each operation. ```graphql mutation { BasicPricing: createPricing( input: { name: "Basic rule" price: { amount: 5, currency: EUR } } ){ name } HomeDeliveryPricing: createPricing( input: { name: "Home Delivery Pricing" price: { amount: 5, currency: EUR, condition: { isHomeDelivery: true, } } } ){ name } PickupPricing: createPricing( input: { name: "Home Delivery Pricing" price: { amount: 5, currency: EUR, condition: { isPickupPoint: true, } } } ){ name } } ``` -------------------------------- ### Initialize Order with upsertOrder Mutation Source: https://docs.deliverygateway.io/dev/how-tos/orders/create-an-order Demonstrates the initial step of creating an order by assigning a reference ID and a creation timestamp in the required ISO 8601 format. ```GraphQL mutation { upsertOrder( input: { referenceId: "123456", createdAt: $date } ) } ``` -------------------------------- ### MerchantSubscriptionPeriod Object Source: https://docs.deliverygateway.io/api/merchant/types/objects/merchant-subscription-period Represents a period of a merchant's subscription, including its start and end dates, status, and any overuse charges. ```APIDOC ## MerchantSubscriptionPeriod Object ### Description Represents a period of a merchant's subscription, including its start and end dates, status, and any overuse charges. ### Fields #### `from` (DateTimeTz!) - Required - The start date and time of the subscription period. #### `to` (DateTimeTz!) - Required - The end date and time of the subscription period. #### `status` (MerchantSubscriptionStatusEnum!) - Required - The current status of the subscription period (e.g., active, expired). #### `overuse` (Money) - Optional - Information about any overuse charges incurred during this period. ### Member Of - `MerchantSubscription` object ``` -------------------------------- ### Create Basic Packaging (GraphQL) Source: https://docs.deliverygateway.io/dev/how-tos/create-packaging Defines a basic package with a human-readable name and an identifying handle. This is the minimum required information to create a new package. ```graphql mutation { createPackaging( input: { name: "Normal", handle: "normal", } ) } ``` -------------------------------- ### IntRangeFilter Input Type Source: https://docs.deliverygateway.io/api/merchant/types/inputs/int-range-filter Defines the structure for an integer range filter, specifying start and end values. ```APIDOC ## IntRangeFilter ### Description Represents a filter for a range of integers, with optional start and end points. ### Method N/A (Input Type Definition) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body ##### `IntRangeFilter` Object - **start** (Int) - Optional - The starting integer of the range. - **end** (Int) - Optional - The ending integer of the range. ### Request Example ```json { "start": 10, "end": 50 } ``` ### Response #### Success Response (N/A for input types) N/A #### Response Example N/A ``` -------------------------------- ### GraphQL Queries Source: https://docs.deliverygateway.io/dev/getting-started/graphql GraphQL queries are used to retrieve data from the API. They specify the exact fields needed, similar to GET requests in REST. ```APIDOC ## GraphQL Queries ### Description Queries are used to request data from specific fields of objects defined in the GraphQL schema. They are analogous to GET requests in a REST API. ### Method POST ### Endpoint `/graphql` ### Request Body - **query** (String) - Required - The GraphQL query string. ### Request Example ```graphql query { providers { id name } } ``` ### Response #### Success Response (200) - **data** (Object) - Contains the result of the query. - **providers** (Array) - List of providers. - **id** (String) - The provider's ID. - **name** (String) - The provider's name. #### Response Example ```json { "data": { "providers": { "id": "RIV", "name": "Red Ivorp" } } } ``` ``` -------------------------------- ### Create Packaging with Dimensions (GraphQL) Source: https://docs.deliverygateway.io/dev/how-tos/create-packaging Creates a package and sets its physical dimensions (width, length, height) in meters. All dimension values must be provided and can be fractional. ```graphql mutation { createPackaging( input: { name: "Normal", handle: "normal", dimensions: { width: 1.5, length: 5.3, height: 2.2, }, } ) } ``` -------------------------------- ### Standard Cart Drawer Configuration (JSON) Source: https://docs.deliverygateway.io/admin/shopify/theme-customization This JSON configuration is for themes with a standard `
`-based cart drawer that does not use shadow DOM. It defines the main drawer element selector, the target element for widget insertion, and the desired insertion position relative to the target. ```json { "drawerSelector": "#CartDrawer", "drawerContainerTarget": ".drawer__footer", "containerInsertPosition": "below" } ``` ```json { "drawerSelector": "cart-drawer.active", "drawerContainerTarget": "cart-drawer .cart-drawer__footer", "containerInsertPosition": "above" } ``` -------------------------------- ### Create Shipment Mutation Source: https://docs.deliverygateway.io/dev/how-tos/create-shipment This section details the `createShipment` GraphQL mutation used to create a new shipment. It outlines the minimum required fields and provides an example. ```APIDOC ## POST /graphql ### Description Creates a new shipment with the provided details. This mutation returns the unique ID of the created shipment. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **input** (object) - Required - The input object for creating a shipment. It must include `provider`, `referenceId`, `recipient`, and `destination`. - **provider** (ProviderEnum!) - Required - Specifies the shipping provider. - **referenceId** (String!) - Required - The unique identifier for the shipment. - **recipient** (object) - Required - Information about the recipient. - **firstName** (String) - Optional - The first name of the recipient. - **lastName** (String) - Optional - The last name of the recipient. - **language** (String!) - Required - The preferred language of the recipient (e.g., HU). - **email** (String) - Optional - The email address of the recipient. - **phone** (String) - Optional - The phone number of the recipient. - **destination** (object) - Required - The delivery destination for the shipment. - **pickupPointId** (String) - Optional - The ID of the pickup point for delivery. - **address** (object) - Optional - The full delivery address. - **country** (String!) - Required - The country code (e.g., HU, CA). - **city** (String!) - Required - The city name. - **postalCode** (String!) - Required - The postal code. - **addressLine1** (String!) - Required - The first line of the street address. - **addressLine2** (String) - Optional - The second line of the street address. - **state** (String) - Optional - The state or province. - **note** (String) - Optional - Additional notes for the address. - **location** (object) - Optional - Precise geographical coordinates for delivery. - **latitude** (Float!) - Required - The latitude coordinate. - **longitude** (Float!) - Required - The longitude coordinate. ### Request Example ```json mutation { createShipment( input: { provider: "RIV", referenceId: "12345", recipient: { firstName: "Fictitious", lastName: "Customer", language: "HU", email: "example_customer@example.org", phone: "00 01 234 5678" }, destination: { address: { country: "CA", state: "Ontario", city: "Ottawa", postalCode: "K2C 0A6", addressLine1: "1026 Baseline Rd", addressLine2: "Building B, 4th floor", note: "The receptionist is grumpy" } } } ) { id } } ``` ### Response #### Success Response (200) - **id** (String) - The unique identifier of the created shipment. #### Response Example ```json { "data": { "createShipment": { "id": "shp_123abc456def" } } } ``` ``` -------------------------------- ### Define OpeningHourInput GraphQL Schema Source: https://docs.deliverygateway.io/api/merchant/types/inputs/opening-hour-input Defines the structure for an opening hour input in GraphQL. It requires the day of the week, a start time, and an end time. This input type is part of the PickupPointOpeningHoursInput. ```graphql input OpeningHourInput { day: DayEnum! start: TimeInput! end: TimeInput! } ``` -------------------------------- ### Query Merchant Configuration using GraphQL Source: https://docs.deliverygateway.io/dev/concepts/merchant Demonstrates how to retrieve a specific merchant configuration value, such as currency, using the 'me' keyword and the 'configuration' field with a key argument. ```graphql query { me { configuration(key: CURRENCY) { key value } } } ``` ```json { "data": { "me": { "configuration": { "key": "CURRENCY", "value": "EUR" } } } } ``` -------------------------------- ### Define OpeningHour GraphQL Type Source: https://docs.deliverygateway.io/api/merchant/types/objects/opening-hour The OpeningHour type represents a time range for a specific day of the week. It consists of a DayEnum for the day, and Time objects for the start and end of the operational hours. ```graphql type OpeningHour { day: DayEnum! start: Time! end: Time! } ``` -------------------------------- ### Configure and Mount DGW Instance with Validation Source: https://docs.deliverygateway.io/dev/how-tos/frontend-integration/example-configurations Demonstrates how to initialize the DGW instance using the mount method, configure the delivery method view, and implement custom address validation logic. It includes handling the recipient object and integrating custom callback functions for address selection. ```javascript function isEmailValid(email) { // Merchant custom email validation. return true; } function handleAddress(address) { // Display, save etc. the selected address. } const instance = DGW.mount({ containerId: "delivery-gateway", merchantId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", view: { type: "delivery-method-selection", openSelectedMethodInModal: true, operatorsAsSeparateMethods: true, }, onAddressSelected: (result) => { if (!isEmailValid(result.recipient.email)) { return Promise.resolve({ isValid: false, errors: { email: "Oops, your email address does not appear to be valid!", }, }); } handleAddress(result); }, recipient: { email: "account@domain.tld", }, }); ``` -------------------------------- ### Define IntRangeFilter GraphQL Input Type Source: https://docs.deliverygateway.io/api/merchant/types/inputs/int-range-filter Defines the IntRangeFilter input object for GraphQL schemas. It accepts optional start and end integer values to facilitate range-based filtering. ```graphql input IntRangeFilter { start: Int end: Int } ``` -------------------------------- ### Querying with Arguments Source: https://docs.deliverygateway.io/dev/getting-started/graphql Illustrates how to pass arguments to fields to filter results, such as retrieving shipment details by a specific ID. ```graphql query { shipment(id: 215099) { provider mode } } ``` ```json { "data": { "shipment": { "provider": "Red Ivorp", "mode": "SENDER_TO_RECIPIENT" } } } ``` -------------------------------- ### Define FloatRangeFilter GraphQL Input Type Source: https://docs.deliverygateway.io/api/merchant/types/inputs/float-range-filter Defines the FloatRangeFilter input object type for GraphQL schemas. It accepts optional 'start' and 'end' float values to represent a numeric range. ```graphql input FloatRangeFilter { start: Float end: Float } ``` -------------------------------- ### Create Default Packaging with Dimensions (GraphQL) Source: https://docs.deliverygateway.io/dev/how-tos/create-packaging Creates a package, sets its dimensions, and designates it as the default option for shipments using the `isDefault` field. The mutation returns the name of the created package. ```graphql mutation { createPackaging( input: { name: "Normal", handle: "normal", dimensions: { width: 1.5, length: 5.3, height: 2.2, }, isDefault: true } ) { name } } ``` -------------------------------- ### mutation createPickupPoint Source: https://docs.deliverygateway.io/dev/how-tos/create-custom-pickup-point Creates a new pickup point location with specific address details, accessibility settings, and payment options. ```APIDOC ## mutation createPickupPoint ### Description Creates a new pickup point in the system. Supports configuration for wheelchair accessibility and multiple cash-on-delivery payment methods. ### Method POST (GraphQL Mutation) ### Endpoint /graphql ### Parameters #### Request Body - **input** (Object) - Required - The pickup point configuration object. - **referenceId** (String) - Required - Unique identifier for the store. - **name** (String) - Required - Display name of the store. - **phone** (String) - Required - Contact phone number. - **address** (Object) - Required - Address details (country, city, postalCode, addressLine1). - **location** (Object) - Required - Geographic coordinates (latitude, longitude). - **isActive** (Boolean) - Required - Status of the pickup point. - **hasWheelChairAccess** (Boolean) - Optional - Indicates if the store is wheelchair accessible. - **cashOnDelivery** (Array) - Optional - List of accepted payment methods (CASH, CARD). ### Request Example { "query": "mutation { createPickupPoint(input: { referenceId: \"123abc\", name: \"My Store\", hasWheelChairAccess: true, cashOnDelivery: [CASH, CARD] }) }" } ### Response #### Success Response (200) - **data** (Object) - The created pickup point object. #### Response Example { "data": { "createPickupPoint": { "referenceId": "123abc", "status": "success" } } } ``` -------------------------------- ### Define FloatRange GraphQL Type Source: https://docs.deliverygateway.io/api/merchant/types/objects/float-range The FloatRange type is a custom GraphQL object used to define a numerical range. It consists of two non-null Float fields, start and end, representing the boundaries of the range. ```graphql type FloatRange { start: Float! end: Float! } ``` -------------------------------- ### Define DateTimeRangeFilter GraphQL Input Type Source: https://docs.deliverygateway.io/api/merchant/types/inputs/date-time-range-filter Defines the GraphQL input object DateTimeRangeFilter, which accepts start and end timestamps. This filter is used to constrain queries within specific time boundaries. ```graphql input DateTimeRangeFilter { start: DateTimeTz end: DateTimeTz } ``` -------------------------------- ### Define DateRangeFilter GraphQL Input Type Source: https://docs.deliverygateway.io/api/merchant/types/inputs/date-range-filter This GraphQL input type defines a range filter using two Date scalar fields. It is intended for use in queries or mutations that require filtering results between a start and end date. ```graphql input DateRangeFilter { start: Date end: Date } ``` -------------------------------- ### Fetch paginated pricings via GraphQL Source: https://docs.deliverygateway.io/api/merchant/operations/queries/pricings Defines the GraphQL query structure for retrieving pricing data. It requires a 'first' argument for limit and an optional 'page' argument for offset, returning a PricingPaginator object. ```graphql pricings( first: Int! page: Int ): PricingPaginator! ``` -------------------------------- ### GraphQL Query: Fetch Packagings with Pagination Source: https://docs.deliverygateway.io/api/merchant/operations/queries/packagings This GraphQL query retrieves a paginated list of packaging items. The 'first' argument limits the number of items, and the 'page' argument specifies the offset. The result is a 'PackagingPaginator' object containing a list of packaging items. ```graphql query GetPackagings($first: Int!, $page: Int) { packagings(first: $first, page: $page) { # Fields for PackagingPaginator would go here, e.g.: # items { # id # name # } # totalCount } } ``` -------------------------------- ### Add Shipping Information to Order (GraphQL) Source: https://docs.deliverygateway.io/dev/how-tos/orders/assign-shipping-to-order This GraphQL mutation adds shipping information to an order. It requires the `OrderShippingInput` type, which includes customer details, delivery method, provider, and status. The example demonstrates setting these fields for a `PICKUP_POINT` delivery method. ```graphql mutation { upsertOrder( input: { [...], shipping: { name: "Example Customer", email: "ec@example.org", phone: "0036701234567", method: PICKUP_POINT, provider: "Red Ivorp", status: IN_PROGRESS } } ) } ``` -------------------------------- ### Mount Delivery Method Selector - Basic Setup Source: https://docs.deliverygateway.io/dev/how-tos/frontend-integration/create-delivery-selector Mounts the delivery method selector for the Delivery Gateway embedded UI. Requires a container element ID and either a merchant ID or session ID. The `type` property must be set to `delivery-method-selection`. ```javascript window.DGW.mount({ containerId: "delivery-gateway", merchantId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", view: { type: "delivery-method-selection", }, }); ``` -------------------------------- ### Performing Nested Mutations in GraphQL Source: https://docs.deliverygateway.io/dev/getting-started/graphql Shows how to pass complex, nested input objects into mutations such as upsertOrder, including nested address details. ```graphql mutation { upsertOrder( input: { billing: { name: "Most Excellent Customer", email: "examplemail@example.org", phone: "00 01 123 4567", vatNumber: "8337961152" isCompany: true, address: { country: CA, state: "Ontario" city: "Ottawa", postalCode: "K2C 0A6", addressLine1: "1026 Baseline Rd", addressLine2: "Building B, 4th floor" note: "The receptionist is grumpy" } } } ) } ``` -------------------------------- ### Create Webhook Mutation Source: https://docs.deliverygateway.io/api/merchant/types/inputs/create-webhook-input This section details the `createWebhook` mutation and its input type `CreateWebhookInput`. ```APIDOC ## POST /graphql ### Description Creates a new webhook subscription for receiving event notifications. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body - **query** (String) - Required - The GraphQL query string. - **variables** (Object) - Optional - Variables for the query. ### Request Example ```json { "query": "mutation CreateWebhook($input: CreateWebhookInput!) { createWebhook(input: $input) { success message } }", "variables": { "input": { "webhook": "DELIVERY_STATUS_CHANGED", "transport": "HTTP", "url": "https://example.com/webhook" } } } ``` ### Response #### Success Response (200) - **data** (Object) - The result of the mutation. - **createWebhook** (Object) - The result of the createWebhook mutation. - **success** (Boolean) - Indicates if the webhook creation was successful. - **message** (String) - A message describing the result of the operation. #### Response Example ```json { "data": { "createWebhook": { "success": true, "message": "Webhook created successfully." } } } ``` ## Input: CreateWebhookInput ### Description Defines the input structure for creating a webhook. ### Fields #### `webhook` (WebhookEnum!) - Required - The type of webhook event to subscribe to. #### `transport` (TransportEnum!) - Required - The transport protocol for the webhook. #### `url` (String!) - Required - The URL where the webhook events should be sent. ``` -------------------------------- ### Enable Cash on Delivery Payment Methods Source: https://docs.deliverygateway.io/dev/how-tos/create-custom-pickup-point This mutation shows how to configure the cashOnDelivery field by passing an array of accepted payment methods such as CASH or CARD. This allows customers to settle payments directly at the pickup point location. ```graphql mutation { createPickupPoint( input: { referenceId: "123abc", name: "My Store", phone: "01 234 5678", address: { country: HU, city: "Budapest", postalCode: "1061", addressLine1: "Nyugati tér 1." } location: { latitude: 47.50969187518572, longitude: 19.05571832644608 } isActive: true, cashOnDelivery: [ CASH, CARD ] } ) } ``` -------------------------------- ### Dialog-based Cart Drawer Configuration (JSON) Source: https://docs.deliverygateway.io/admin/shopify/theme-customization This JSON configuration is for themes using a `` HTML element for the cart drawer, often rendering content within a shadow DOM. It specifies selectors for the drawer, the target container within the drawer, insertion position, and shadow DOM root. ```json { "drawerSelector": ".cart-drawer__dialog[open]", "drawerContainerTarget": ".cart__summary-totals", "containerInsertPosition": "below", "portalShadowRoot": "dialog.cart-drawer__dialog", "resizeDrawerModal": true } ``` -------------------------------- ### Create Pickup Point GraphQL Mutation Source: https://docs.deliverygateway.io/api/merchant/operations/mutations/create-pickup-point This mutation is used to create a new pickup point within the delivery gateway system. It requires a non-null CreatePickupPointInput object as an argument and returns a PickupPoint object upon successful execution. ```graphql createPickupPoint( input: CreatePickupPointInput! ): PickupPoint! ``` -------------------------------- ### Retrieve Data with GraphQL Queries Source: https://docs.deliverygateway.io/dev/getting-started/graphql Demonstrates how to fetch specific fields from a GraphQL service. The query requests provider information, and the service returns the result in a structured JSON format. ```graphql query { providers { id name } } ``` ```json { "data": { "providers": { "id": "RIV", "name": "Red Ivorp" } } } ``` -------------------------------- ### POST /themes Source: https://docs.deliverygateway.io/api/merchant/operations/mutations/create-theme Creates a new theme with the provided input. This endpoint allows for the creation of custom themes by specifying various properties. ```APIDOC ## POST /themes ### Description Creates a new theme with the provided input. ### Method POST ### Endpoint /themes ### Parameters #### Request Body - **input** (CreateThemeInput!) - Required - Input object for creating a theme. ### Request Example ```json { "input": { "name": "My New Theme", "colors": { "primary": "#007bff", "secondary": "#6c757d" }, "fonts": { "body": "Arial, sans-serif", "heading": "Georgia, serif" } } } ``` ### Response #### Success Response (200) - **Theme** (Theme!) - The created theme object. #### Response Example ```json { "id": "theme_abc123", "name": "My New Theme", "colors": { "primary": "#007bff", "secondary": "#6c757d" }, "fonts": { "body": "Arial, sans-serif", "heading": "Georgia, serif" }, "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Upsert order payment information via GraphQL Source: https://docs.deliverygateway.io/dev/how-tos/orders/add-billing-to-order Demonstrates how to attach payment methods and statuses to an order. It covers standard card payments, cash-on-delivery options, and updating the payment status to paid with a timestamp. ```GraphQL mutation { upsertOrder( input: { referenceId: "123456", createdAt: $date, payment: { method: "card" status: PENDING } } ) } ``` ```GraphQL mutation { upsertOrder( input: { referenceId: "123456", createdAt: $date, cashOnDelivery: { amount: 13599, currency: HUF } } ) } ``` ```GraphQL mutation { upsertOrder( input: { referenceId: "123456", createdAt: $date, payment: { method: "card" status: PAID, paidAt: "2026-01-17T14:32:10+01:00" } } ) } ``` -------------------------------- ### POST /createPickupPoint Source: https://docs.deliverygateway.io/api/merchant/types/inputs/create-pickup-point-input Defines the input structure for the createPickupPoint mutation, used to register a new pickup point location. ```APIDOC ## POST /createPickupPoint ### Description This mutation creates a new pickup point in the delivery system using the CreatePickupPointInput object. ### Method POST (GraphQL Mutation) ### Endpoint /graphql ### Request Body - **referenceId** (String!) - Required - Unique identifier for the pickup point. - **name** (String!) - Required - Display name of the pickup point. - **phone** (String) - Optional - Contact phone number. - **cashOnDelivery** ([PaymentMethodEnum!]) - Optional - List of supported cash on delivery methods. - **hasWheelchairAccess** (Boolean) - Optional - Indicates if the location is wheelchair accessible. - **address** (AddressInput!) - Required - Physical address details. - **location** (LocationInput!) - Required - Geographic coordinates. - **openingHours** (PickupPointOpeningHoursInput) - Optional - Operating hours configuration. - **tags** ([PickupPointTagInput!]) - Optional - Metadata tags for the location. - **isActive** (Boolean!) - Required - Status of the pickup point. ### Request Example { "query": "mutation { createPickupPoint(input: { referenceId: \"PP-001\", name: \"Downtown Hub\", address: {...}, location: {...}, isActive: true }) { id } }" } ### Response #### Success Response (200) - **id** (ID) - The unique identifier of the created pickup point. #### Response Example { "data": { "createPickupPoint": { "id": "12345" } } } ``` -------------------------------- ### Initialize Delivery Gateway Instance Source: https://docs.deliverygateway.io/dev/how-tos/frontend-integration/example-configurations Demonstrates the basic mounting of the DGW instance using a merchant ID and a target HTML container element. This is the foundational step for all DGW plugin interactions. ```javascript window.DGW.mount({ merchantId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", container: document.getElementById("delivery-gateway"), }); ``` -------------------------------- ### Mount Delivery Gateway Instance Source: https://docs.deliverygateway.io/dev/how-tos/frontend-integration/set-up-dgw-on-frontend Mounts a Delivery Gateway instance to a specified HTML container. The `opts` object must include `merchantId`, `containerId`, and `view` properties to define the instance and its configuration. ```javascript window.DGW.mount({ merchantId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", containerId: "delivery-gateway", view: { type: "" } }) ```