DebitLlama
  • DebitLlama Documentation
  • What is wallet abstraction?
  • Account Creation and Checkout flow
  • How DebitLlama compares to others?
  • Process payments via Solvers
  • Payment Intents
    • ZKP Implementation details
    • Smart Contract Implementation details
    • Client Side Implementation
    • Security first. A little game theory.
  • Creating Accounts
  • Comparing Account types
  • Accepting Payments
    • Checkout Redirect
    • Managing your items
    • Checkout page
  • Fees
  • Passkeys
  • Rest Api v1
    • Creating Access Tokens
      • What is Bearer Authentication?
    • Schema
    • Networks and Currencies
    • /api/v1
    • /api/v1/accounts
    • /api/v1/accounts/[commitment]
    • /api/v1/payment_intents
    • /api/v1/payment_intents/[slug]
    • /api/v1/items
    • /api/v1/items/[slug]
    • Configuring Webhooks
      • Request Schema
    • Zapier Integration
  • Try it out on Testnet
  • Slack
Powered by GitBook
On this page
  • reason
  • link
  • version and home
  • Example Webhook code
  1. Rest Api v1
  2. Configuring Webhooks

Request Schema

The Webhook implementation needs to support the following scheme

type WebhookRequest = {
  reason:
    | "SubscriptionCreated"
    | "SubscriptionCancelled"
    | "SubscriptionEnded"
    | "Payment"
    | "PaymentFailure"
    | "DynamicPaymentRequestRejected";
  link: string;
  version: "v1";
  home: "https://debitllama.com";
};

reason

You can receive a webhook request for the following reasons

  1. SubscriptionCreated - A new subscription was approved for one of your items

  2. SubscriptionCancelled - An existing subscription was cancelled

  3. Payment - A successful payment

  4. PaymentFailure - Payment failed, could be due to missing relayer or account balance!

  5. DynamicPaymentRequestRejected - The Request to make a direct debit with a custom amount was rejected during relaying. Payment can't be processed.

link

A link to the payment intent using APIV1

https://debitllama.com/api/v1/payment_intents/[paymentIntent]

You can fetch the details of the payment intent using the link via GET request

version and home

The version and home keys store meta data The API version and the URL of the service.

Example Webhook code

Deno.serve(async (req) => {
  const wr: WebhookRequest = await req.json();
  
  //You can fetch the Payment Intent details using the link
  const piRes = await fetch(wr.link, { method: "GET" });
  const paymentIntent : PaymentIntent_ApiV1 = await piRes.json();

  switch (wr.reason) {
    //Add your Business Logic
    case "SubscriptionCreated":
      break;
    case "SubscriptionCancelled":
      break;
    case "SubscriptionEnded":
      break;
    case "Payment":
      break;
    case "PaymentFailure":
      break;
    case "DynamicPaymentRequestRejected":
      break;
    default:
      break;
  }

  return new Response(
    null,
    { status: 200, headers: { "Content-Type": "application/json" } },
  );
});

PreviousConfiguring WebhooksNextZapier Integration

Last updated 1 year ago

/api/v1/payment_intents/[slug]