Skip to content

AndaHendriksen/deno_paddle_verify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno Paddle Webhook Verify

A small deno module to verify webhook signatures so you can easily build support for Paddle Webhooks in to Supabase Edge Functions.

This is for the billing version of Paddle not Classic. Read the Paddle signature verification docs.

Using in Supabase function

Write a Supabase edge function that looks a bit like this:

import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { validateSignature } from "https://raw.githubusercontent.com/boardshape/deno_paddle_verify/main/mod.ts";

serve(async (req) => {
  const secretKey = Deno.env.get(PADDLE_WEBHOOK_SECRET);

  const signature = req.headers.get("Paddle-Signature");

  if (!signature) {
    return new Response("Missing paddle signature", { status: 400 });
  }

  const body = await req.text();

  const data = {
    isValid: (await validateSignature(signature, body, secretKey))
      ? "Signature is good"
      : "Signature is bad",
  };

  return new Response(JSON.stringify(data), {
    headers: { "Content-Type": "application/json" },
  });
});

Note For security and reliability we don't recommend you import the library off our repo. Fork this project and import it off your own github account.

Tests

Run:

deno test

About BoardShape

BoardShape is board management software for startups - check it out if you want to run better board meetings.

License

deno_paddle_verify is released under the MIT License. See the bundled LICENSE file for details.

About

Deno module to verify signatures from Paddle webhooks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%