Webhooks
Webhooks enable real-time notifications for key Lune events. Currently, Lune supports webhooks for the following event types:- Completion of transaction document processing.
- Status change of a carbon credit order.
- Create and expose a webhook endpoint on your server to receive events.
- Register the endpoint with Lune.
Pre-requisites
Complete the following setup steps before using this guide:
Generate an API key and authenticate your account.

Log in and familiarize yourself with the Lune dashboard.
1. Set up receiver endpoint
Create an HTTPS endpoint on your server to act as the webhook receiver, just like any standard web page or API endpoint.Make sure to note the public URL. You’ll need it to register the webhook with Lune in the next step.Lune requires HTTPS endpoints, including for testing. Plain HTTP is not supported.
2. Register with Lune
You can register your webhook endpoint via the Lune Dashboard or using the API.Using the dashboard
- Go to the Developers tab in the Lune Dashboard.
- Click New Live Webhook and enter your endpoint URL.
Using the API
To register via API, send aPOST request to the /webhooks endpoint with your url.- Webhooks created with test API keys will only receive test events.
- Webhooks created with live API keys will receive live events.
Sample request
Sample response
3. Process incoming events
Lune delivers events in account-specific order. All events for a given account ID are guaranteed to be delivered in the order they occurred.Events are sent in batches, and your receiver must return a 2xx status code within 30 seconds to acknowledge successful delivery. If an acknowledgment is not received, Lune will retry delivery until the event is acknowledged.Because events are delivered in order, a few unacknowledged events can block subsequent events in your webhook queue.Each request payload will contain several fields, including anevent_type that identifies the nature of the event. You can find the list of possible event types below.Authenticity and integrity
To ensure event authenticity, Lune signs every webhook payload and includes a signature in theLune-HMAC header.timestamp=TIMESTAMP,organisation=ORGANISATION_ID,v1=HMAC_VALUE,...TIMESTAMPORGANISATION_IDHMAC_VALUEVerify signature
In order to verify the authenticity of the request received by your endpoint, you'll need to verify the signature of the request. You can do this by extracting the:TIMESTAMPfrom theLune-HMACheader of the request,bodyfrom the payload of the request,secretreturned from the API response when you first registered the endpoint.
HMAC_SHA256(SECRET, TIMESTAMP + "." + BODY)Ensure the computed signature matches the HMAC_VALUE in the header of the request to complete your verification.Idempotency
Lune follows an "at-least-once" delivery model, meaning events may be delivered multiple times. Your webhook receiver must be able to handle duplicate events safely.To support idempotency, you can:- Track the
event_id: Ignore events that have already been processed. - Track
sequencevalues: For each account, ignore events with a lower lexicographicalsequencethan the most recent one processed.
Event types
Transaction document processing
transaction_document.successtransaction_document.errorCarbon credit orders
order.receivedorder.placedorder.paidorder.retiringorder.cancelledorder.completed
