Request Schema
The Webhook implementation needs to support the following scheme
Last updated
The Webhook implementation needs to support the following scheme
Last updated
type WebhookRequest = {
reason:
| "SubscriptionCreated"
| "SubscriptionCancelled"
| "SubscriptionEnded"
| "Payment"
| "PaymentFailure"
| "DynamicPaymentRequestRejected";
link: string;
version: "v1";
home: "https://debitllama.com";
};
You can receive a webhook request for the following reasons
SubscriptionCreated - A new subscription was approved for one of your items
SubscriptionCancelled - An existing subscription was cancelled
Payment - A successful payment
PaymentFailure - Payment failed, could be due to missing relayer or account balance!
DynamicPaymentRequestRejected - The Request to make a direct debit with a custom amount was rejected during relaying. Payment can't be processed.
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
The version and home keys store meta data The API version and the URL of the service.
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" } },
);
});