omnitrade / shopify
Omnitrade Shopify: a sale paid on the shop's invoice page (draft orders), the shop's orders, its catalogue (products, variants, inventory) and its webhooks, over the Admin GraphQL API.
Requires
- php: >=8.2
- omniscient/omnitrade: ^1.0@dev
- psr/log: ^1.1|^2.0|^3.0
- symfony/http-client: ^6.4|^7.0|^8.0
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-17 14:09:10 UTC
README
Shopify for omniscient/omnitrade: a sale paid on the shop's invoice page (a draft order with your prices), the shop's orders, its catalogue, and its webhooks - over the Admin GraphQL API, its cost bucket respected.
$gateway = (new ShopifyGatewayFactory($http))->create(['shop_domain' => 'example.myshopify.com', 'admin_token' => '...']); // $http: the application's HTTP client; none given, the factory makes its own
No framework needed: the package requires omniscient/omnitrade and symfony/http-client. In a
Symfony application, the same through the bundle's configuration:
omnitrade: gateways: shopify: factory: shopify options: shop_domain: '%env(SHOPIFY_SHOP_DOMAIN)%' # example.myshopify.com admin_token: '%env(SHOPIFY_ADMIN_TOKEN)%' # shpat_..., a custom app's Admin API token webhook_secret: '%env(SHOPIFY_WEBHOOK_SECRET)%' # the app's API secret, for notify() draft_order_tags: [omnitrade] currency: null # the catalogue's currency; null: the shop's
purchase() creates a draft order and answers PENDING with its invoice URL; Shopify never
redirects back, so fetch() (the draft completed into a paid order, or deleted) and notify()
(orders/paid, orders/cancelled, refunds/create, HMAC and shop checked) finish the sale.
fetchOrder() reads any order of the shop. A line whose reference is a variant gid names
the variant, so Shopify counts its stock; any other line is a custom one at the price given.
No authorizations, captures nor refunds from here: Shopify's admin does those on its orders.
Catalogue
fetchProducts() pages through the shop's products (updated_at and search filters),
fetchProduct() finds one by gid, bare id, handle or page URL, fetchInventory() reads the
variants' quantities; notify() reads products/create|update|delete and
inventory_levels/update into a Notification carrying the Product or the Stock. Vendor is
the brand, product type and collections the categories, metafields the attributes, the variants'
selected options their options. See docs/catalogue.md; it needs the
read_products and read_inventory scopes.
Credentials: a custom app in the shop's admin (Settings → Apps → Develop apps) with the
write_draft_orders, read_orders scopes, its Admin API access token, and the app's API
secret for the webhooks (orders/paid, orders/cancelled, refunds/create to your endpoint).
Responsibility
This package is an independent, unofficial client: it is not affiliated with, endorsed by or sponsored by Shopify Inc. It reaches their service on behalf of whoever runs it, and it does not redistribute their data beyond the short excerpts recorded as test fixtures. Its MIT licence covers this package's code only and grants no right to the service or to its data.
Whoever installs and runs this package is responsible for complying with Shopify's terms (Shopify API License and Terms of Use), for obtaining whatever they require (an account, a key, a licence or subscription, an attribution or a citation, a rate limit to respect), and for any use made of what it returns. The authors publish it free of charge, make no commercial use of it, and accept no liability for how it is used (see LICENSE).
License: MIT since 2026-10-09; earlier versions remain published under LGPL-3.0-or-later.