Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

polar-sveltekit

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polar-sveltekit

Polar integration for SvelteKit

latest
npmnpm
Version
0.0.4
Version published
Weekly downloads
4
Maintainers
0
Weekly downloads
 
Created
Source

polar-sveltekit

Payments and Checkouts made dead simple with Sveltekit.

pnpm install polar-sveltekit

Checkout

Create a Checkout handler which takes care of redirections.

// /api/checkout/+server.ts
import { Checkout } from "polar-sveltekit";

export const GET = Checkout({
  accessToken: process.env.POLAR_ACCESS_TOKEN,
  successUrl: process.env.SUCCESS_URL,
  server: "sandbox", // Use sandbox if you're testing Polar - omit the parameter or pass 'production' otherwise
});

Query Params

Pass query params to this route.

  • productId (required) ?productId=xxx
  • customerId (optional) ?productId=xxx&customerId=xxx
  • customerEmail (optional) ?productId=xxx&customerEmail=janedoe@gmail.com
  • customerName (optional) ?productId=xxx&customerName=Jane

Webhooks

A simple utility which resolves incoming webhook payloads by signing the webhook secret properly.

// api/webhook/polar/route.ts
import { Webhooks } from "polar-sveltekit";

export const POST = Webhooks({
  webhookSecret: process.env.POLAR_WEBHOOK_SECRET!,
  onPayload: async (payload) => {
    // Handle the payload
    // No need to return an acknowledge response
  },
});

Keywords

polar

FAQs

Package last updated on 05 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts