Skip to main content

Checkout

The authenticate.public.checkout function ensures that checkout extension requests are coming from Shopify, and returns helpers to respond with the correct headers.

Authenticates requests coming from Shopify checkout extensions.

Anchor to request
request
Request
required
Anchor to options
options

Promise<>
Examples

app/routes/public/my-route.ts

import { LoaderArgs, json } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import { getMyAppData } from "~/db/model.server";

export const loader = async ({ request }: LoaderArgs) => {
const { sessionToken, cors } = await authenticate.public.checkout(
request,
{ corsHeaders: ["X-My-Custom-Header"] }
);
const data = await getMyAppData({shop: sessionToken.dest});
return cors(json(data));
};

Was this page helpful?