Hi, I’m using shopify_app gem, and the webhook related with orders doesnt trigger anything in a development store. I create and update orders directly in the store also using the API in my console without see any request.
The only that works are: app/uninstalled and products/update
my configuration:
ShopifyApp.configure do |config|
config.webhooks = [
{ topic: "app/uninstalled", path: "webhooks/uninstalled" },
{ topic: "orders/create", path: "webhooks/orders_create" },
{ topic: "orders/paid", path: "webhooks/orders_paid" },
{ topic: "orders/fulfilled", path: "webhooks/orders_fulfilled" },
{ topic: "products/update", path: "webhooks/products_update" }
]
config.application_name = "rave"
config.old_secret = ""
config.scope = "read_products, read_orders, write_orders" # Consult this page for more scope options:
# https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes
config.embedded_app = true
config.after_authenticate_job = false
config.api_version = "2022-10"
config.shop_session_repository = 'Shop'
config.reauth_on_access_scope_changes = true
config.api_key = ENV.fetch('SHOPIFY_API_KEY', '').presence
config.secret = ENV.fetch('SHOPIFY_API_SECRET', '').presence
if defined? Rails::Server
raise('Missing SHOPIFY_API_KEY. See https://github.com/Shopify/shopify_app#requirements') unless config.api_key
raise('Missing SHOPIFY_API_SECRET. See https://github.com/Shopify/shopify_app#requirements') unless config.secret
end
end
Rails.application.config.after_initialize do
if ShopifyApp.configuration.api_key.present? && ShopifyApp.configuration.secret.present?
ShopifyAPI::Context.setup(
api_key: ShopifyApp.configuration.api_key,
api_secret_key: ShopifyApp.configuration.secret,
api_version: ShopifyApp.configuration.api_version,
host: ENV['HOST'],
scope: ShopifyApp.configuration.scope,
is_private: !ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', '').empty?,
is_embedded: ShopifyApp.configuration.embedded_app,
session_storage: ShopifyApp::SessionRepository,
logger: Rails.logger,
private_shop: ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', nil),
user_agent_prefix: "ShopifyApp/#{ShopifyApp::VERSION}"
)
ShopifyApp::WebhooksManager.add_registrations
end
end
This is my code for creating an order
order = ShopifyAPI::Order.new(session: session)
order.email = "foo1@example.com"
order.fulfillment_status = "fulfilled"
order.send_receipt = true
order.send_fulfillment_receipt = true
order.line_items = [
{
"variant_id" => 44100045144346,
"quantity" => 1
}
]
order.save!
Is there something that a missing? or what is the correct way to tests the orders webhooks?