datewise/app/lib/billing.server.ts
metatroncubeswdev 6061877ca1 fix(review): no shop-domain form on /auth/login; test charges on dev stores
- /auth/login no longer asks for a myshopify domain (App Store 2.3.1). With
  ?shop= it still hands off to OAuth; otherwise it points to Shopify.
- Billing API charges are test charges outside production and on partner
  development stores (shop.plan.partnerDevelopment), so reviewers can pick a
  paid plan. Real shops are charged as before.
- SCREENCAST.md matches the recording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:07:22 -04:00

13 lines
607 B
TypeScript

import { type AdminGraphql, gql } from "./guard.server";
/**
* Billing API charges are test charges outside production and on development stores
* (including App Store reviewers' stores), which can't take real charges. Real shops pay.
*/
export async function billingIsTest(admin: AdminGraphql): Promise<boolean> {
if (process.env.NODE_ENV !== "production") return true;
const d = await gql<{ shop: { plan: { partnerDevelopment: boolean } } }>(admin, `#graphql
query DatewiseBillingMode { shop { plan { partnerDevelopment } } }`).catch(() => null);
return !!d?.shop.plan.partnerDevelopment;
}