@if (session('success'))
{{ session('success') }}
@endif @if (isset($errors) && $errors->any())
{{ $errors->first() }}
@endif
@csrf
{{ __('Admin · Project settings') }}

{{ __('Shopify') }} {{ __('settings') }}.

{{ __('Configure Shopify app credentials so workspaces can connect their stores and receive WhatsApp notifications for orders, customers, and abandoned checkouts.') }}

{{ __('All settings') }}
{{-- ─────────────────────────────────────────────────────── Step-by-step "How to create your Shopify app" guide. Mirrors the setup-steps pattern on /shopify so admins see the same affordances customers see. ─────────────────────────────────────────────────────── --}}
{{ __('Getting started') }}

{{ __('How to create your Shopify app') }}

{{ __('Follow these six steps on the Shopify Dev Dashboard to issue the credentials you paste below. This only needs to happen once for the whole platform — every workspace then uses the same app via OAuth.') }}

    {{-- Step 1 --}}
  1. 1
    {{ __('Sign in to the Shopify Dev Dashboard') }}

    Go to dev.shopify.com/dashboard and sign in with the email that will own this integration (a free Shopify / Partner login works). This is the new home for building apps — it replaced the Partner Dashboard in 2026.

  2. {{-- Step 2 --}}
  3. 2
    {{ __('Open the Dev Dashboard and create an app') }}

    Open the dev.shopify.com/dashboard → in the left nav pick {{ __('Apps → Create app') }} → {{ __('Start from Dev Dashboard') }}, then name it after your platform.

    {{ __('Note (2026):') }} the {{ __('Dev Dashboard') }} (dev.shopify.com/dashboard) now replaces the old {{ __('Partner Dashboard') }} for building apps. Legacy custom apps from {{ __('Shopify Admin → Apps') }} can no longer be created since Jan 1, 2026 — use the Dev Dashboard (or Shopify CLI).

  4. {{-- Step 3 --}}
  5. 3
    {{ __('Set the App URL and Allowed redirection URL') }}

    Open the app's {{ __('Configuration') }} (in the Dev Dashboard these settings are applied when you release a {{ __('Version') }}) and find the {{ __('URLs') }} section. Also pick the newest {{ __('Webhooks API version') }} there. Paste these exactly — the redirect URL must match what we send to Shopify or OAuth fails with {{ __('redirect_uri mismatch') }}:

    {{ __('App URL') }}
    {{ __('Allowed redirection URL(s)') }}
  6. {{-- Step 4 --}}
  7. 4
    {{ __('Copy the API credentials') }}

    In the Dev Dashboard open {{ __('Apps → your app → Settings → Credentials') }}. Reveal both values and paste them into {{ __('Client ID') }} (a.k.a. {{ __('API Key') }}) and {{ __('Client secret') }} (a.k.a. {{ __('API Secret Key') }}) below. The secret is shown once — copy it carefully.

  8. {{-- Step 5 --}}
  9. 5
    {{ __('Add mandatory GDPR webhooks') }}

    Shopify requires these three GDPR webhooks or install silently fails and the app-review checks stay red. The new Dev Dashboard has no UI field for them — they are declared in the app's shopify.app.toml and pushed once with the Shopify CLI (a one-time setup, no ongoing CLI use):

    1. npm i -g @shopify/cli@latest
    2. shopify app config link — pick this app; it writes shopify.app.toml.
    3. Add the block below to that file, then run shopify app deploy.
    [webhooks]
    api_version = "2026-07"
    
      [[webhooks.subscriptions]]
      compliance_topics = [ "customers/data_request", "customers/redact", "shop/redact" ]
      uri = "{{ url('/shopify/compliance') }}"

    All three topics point to this one fixed URL — copy it:

    Set all three topics — {{ __('customers/data_request') }}, {{ __('customers/redact') }}, {{ __('shop/redact') }} — to this one fixed URL (unlike the per-store order webhook, it carries no secret so Shopify's automated check can reach it before any store installs). Each delivery is HMAC-SHA256 signed with your Client Secret — we verify {{ __('X-Shopify-Hmac-Sha256') }} and reject mismatches with 401.
  10. {{-- Step 6 --}}
  11. 6
    {{ __('Enable Shopify here & save') }}

    Tick the {{ __('Enable Shopify') }} switch in the credentials box and hit {{ __('Save changes') }}. Workspace owners can now connect their stores at /shopify.

{{ __('shopify · oauth credentials') }}

{{ __('App credentials') }}

{{-- Self-serve BYO Shopify app — lets a workspace owner paste their OWN API key + secret on /shopify and connect without these platform credentials. --}}
{{ __('Let workspaces use their OWN Shopify app') }}
{{ __('On: the workspace owner pastes their own API key + secret on the Shopify page and connects — no platform keys needed. Off: everyone uses the platform app above.') }}
{{ __('install-status') }}

{{ __('Install readiness') }}

@php $checks = [ 'credentials saved' => $clientId !== '' && $hasSecret, 'feature enabled' => $enabled, 'redirect set' => $redirectUri !== '', ]; @endphp @foreach ($checks as $label => $ok) {{ $ok ? '✓ ' : '○ ' }}{{ $label }} @endforeach
{{ __('usage') }}

{{ __('Live across workspaces') }}

{{ __('Stores connected') }}
{{ number_format($integrationsCount) }}
{{ __('Active automations') }}
{{ number_format($eventsCount) }}
{{ __('Webhook events received') }}
{{ number_format($logsCount) }}
{{-- Copy-button JS lives in resources/js/charts/admin-settings-shopify.js (auto-loaded via the page="admin-settings-shopify" key in app.js). --}}