Schedule icon
Request icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

Shopify unfulfilled high-risk order fraud review gate

Audit Shopify unfulfilled orders for high fraud risk via GraphQL Admin API, send urgent Slack alerts, and gate fulfillment pipelines to prevent chargebacks.

Categories
BusinessInfrastructure

Protect e-commerce stores against costly chargebacks, shipping fraud, and inventory loss by automatically intercepting high-risk orders before warehouse fulfillment. In high-volume e-commerce stores, automated 3PL warehouse pipelines often fulfill purchases within minutes of placement, leaving merchant fraud teams insufficient time to manually inspect suspicious orders. This sentinel runs on a recurring 15-minute schedule, queries the Shopify Admin GraphQL API for unfulfilled orders flagged with risk_level:high, evaluates fraud exposure, posts an immediate Slack alert detailing customer identities and order values, and fails the execution to act as a hard gate preventing automated warehouse release.

How it works

  1. A Schedule trigger initiates a fraud inspection sweep every 15 minutes (shipped disabled by default).
  2. Task fetch_high_risk_orders uses io.kestra.plugin.graphql.Request to query the Shopify Admin GraphQL API endpoint (https://<shop>.myshopify.com/admin/api/<version>/graphql.json) authenticating via X-Shopify-Access-Token. It requests unfulfilled orders with high fraud risk (fulfillment_status:unfulfilled risk_level:high) capturing order IDs, order names, creation timestamps, monetary totals, and customer emails.
  3. Task evaluate_fraud_risk (io.kestra.plugin.core.flow.If) counts discovered high-risk orders:
    • If any exist: Task alert_fraud_incident transmits a high-priority Slack notification itemizing order numbers, totals, and customer contact information. If inputs.fail_on_detected_fraud is true, task halt_fulfillment_gate (io.kestra.plugin.core.execution.Fail) terminates the run with an error, ensuring downstream automated fulfillment flows abort.
    • If none exist: Task log_orders_clean records that all unfulfilled orders are clean.
  4. Task log_audit_summary records total evaluated high-risk counts.
  5. Top-level errors handler catches API authentication errors or network timeouts.

What you get

  • Real-time interception of fraudulent orders before packages leave the warehouse.
  • Automated protection against friendly fraud, stolen credit cards, and chargeback fee spikes.
  • Itemized Slack notifications containing direct order identifiers and customer emails for immediate manual review.
  • Strict fulfillment gating that seamlessly protects automated shipping and ERP integrations.

Who it's for

  • E-commerce Operations and Merchant Fraud teams managing high-volume Shopify stores.
  • Logistics and Warehouse Fulfillment managers integrating automated 3PL fulfillment.
  • FinOps and Risk teams tasked with reducing payment processor chargeback ratios.

Why orchestrate this with Kestra

Standalone webhooks or manual dashboard checking often fail under high transaction volume or holiday sales spikes. Kestra provides declarative, observable orchestration with native GraphQL request handling, secrets management, dynamic jq payload parsing, and immediate multi-channel alerting. With Kestra, order fraud risk evaluation becomes an automated, version-controlled quality gate embedded directly into your supply chain workflows.

Prerequisites

  • A Shopify store with access to the Shopify Admin API (Custom App or Private App).
  • API scopes including read_orders enabled on the access token.

Secrets

  • SHOPIFY_ACCESS_TOKEN: Shopify Admin API access token (e.g. shpat_...) passed in the X-Shopify-Access-Token header.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to post fraud incident alerts.

Quick start

  1. Create a Custom App in Shopify Admin under Settings > Apps and sales channels > Develop apps with read_orders scope.
  2. Store your access token and Slack webhook in Kestra Secrets (SHOPIFY_ACCESS_TOKEN and SLACK_WEBHOOK_URL).
  3. Configure shopify_shop_name with your store domain slug (e.g. brand-store).
  4. Trigger a manual execution from the Kestra UI to verify that the query successfully connects to your store.
  5. Enable the recurring_fraud_sweep trigger to establish automated 15-minute fraud interception.

How to extend

  • Chain an automated tagging mutation (orderUpdate) via GraphQL to apply a "Needs Fraud Review" tag directly inside Shopify.
  • Place order fulfillment holds via Shopify's FulfillmentOrders API when high-risk indicators match specific geographic regions.
  • Cross-reference customer email addresses with external fraud scoring APIs (such as Sift or MaxMind) for multi-factor risk assessment.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.