import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.products.requestX402Access({
idOrSlug: "<value>",
});
console.log(result);
}
run();{
"id": "<string>",
"object": "<string>",
"product": "<string>",
"price_variant": "<string>",
"order": "<string>",
"access_token": "<string>",
"expires_at": "<string>"
}Returns 402 with payment requirements, or grants access on valid x402 payment. Pass a price_variant query param to select a specific variant, otherwise the first visible variant is used.
import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.products.requestX402Access({
idOrSlug: "<value>",
});
console.log(result);
}
run();{
"id": "<string>",
"object": "<string>",
"product": "<string>",
"price_variant": "<string>",
"order": "<string>",
"access_token": "<string>",
"expires_at": "<string>"
}API key in the format: Bearer {api_token}
The resource prefix ID (e.g., "prod_abc123") or slug (e.g., "my-product")
Price variant ID to use for payment
Was this page helpful?