Skip to Content
Partner APIPartner Webhooks

Partner Webhooks

Edubanc pushes loan and loan-request events to your server, so you never need to poll.

New to webhooks? Read the next five sections first. If you have used signed webhooks before, skip to Authentication.

What a webhook is

Instead of your server repeatedly asking Edubanc “has anything changed?”, Edubanc sends your server a message the moment something happens to a loan or loan request. You give us one HTTPS address, and we POST events to it.

The two secrets, and what each is for

API secretWebhook secret
DirectionYou calling EdubancEdubanc calling you
Used forProving a request is from youProving an event is really from Edubanc
How it travelsSent in the X-EdPay-Api-Secret header on every requestNever sent. Only a signature made with it is sent
How you get a new onePOST /api/partner/credentials/rotate-secretPUT /api/partner/webhook (every call issues a new one)

They are independent: rotating one does not change the other. Both are shown once, and the old value stops working immediately when a new one is issued.

Store both secrets in a secrets manager. Never put them in source code, a browser or a mobile app.

What the webhook secret is

A password shared only between Edubanc and you, created when you set your webhook URL.

Anyone on the internet can send a POST to your webhook address and pretend to be Edubanc. The webhook secret is how you tell a real event from a fake one.

What HMAC is, in plain terms

HMAC-SHA256 is a way to make a “fingerprint” of a message using a secret.

  • Edubanc takes the exact body of the event and the webhook secret, and computes a fingerprint. It sends that as X-EdPay-Signature: sha256=<hex>.
  • Your server takes the same body and your copy of the secret, and computes the fingerprint again.
  • If the two match, the event came from someone who knows the secret (Edubanc) and the body was not changed on the way. If they differ, reject it.

The secret itself never travels, so it cannot be intercepted. Without the secret, nobody can produce a matching fingerprint.

Checking an event, step by step

  1. Read the raw request body exactly as received, before parsing the JSON. Re-serialising parsed JSON can change spacing or key order and break the match. This is the most common mistake.
  2. Compute HMAC-SHA256(webhookSecret, rawBody) and write it as lowercase hex.
  3. Compare sha256=<your hex> with the X-EdPay-Signature header using a constant-time comparison.
  4. If they differ, return 401 and do nothing else. If they match, process the event and return any 2xx.

Ready-made code for this is under Verifying the signature.

Authentication

Partner endpoints use API credentials, not a login. Send both headers on every request, from your backend only (never a browser or mobile app):

X-EdPay-Api-Key: {partnerApiKey} X-EdPay-Api-Secret: {partnerApiSecret}

Edubanc gives you these when your partner account is created, see Get API Keys. The secret is shown once.

Set your webhook URL

PUT /api/partner/webhook

Request body

FieldDescription
webhookUrlRequired. The HTTPS address Edubanc sends events to.
{ "webhookUrl": "https://partner.example.com/edpay-hooks" }

Response 200

{ "success": true, "message": "Request successful", "data": { "partnerApplicationId": "9b2f6c1e-4d7a-4e0b-8f3a-1c5d7e9a2b40", "webhookUrl": "https://partner.example.com/edpay-hooks", "webhookSecret": "whsec_Ab3x..." }, "statusCode": 200 }

data also carries a message string reminding you to store the secret, because it will not be shown again.

  • The URL must be https:// and a public host. localhost, private IP ranges and .internal / .local hosts are rejected.
  • Every call issues a new webhookSecret, and the previous one stops working immediately. It is shown once, so store it now.
  • To get a new secret, call this endpoint again with the same URL.

Rotate your API secret

POST /api/partner/credentials/rotate-secret

No body. Authenticate with your current key and secret.

POST /api/partner/credentials/rotate-secret X-EdPay-Api-Key: {partnerApiKey} X-EdPay-Api-Secret: {currentPartnerApiSecret}

Response 200

{ "success": true, "data": { "partnerApplicationId": "9b2f6c1e-4d7a-4e0b-8f3a-1c5d7e9a2b40", "name": "Your Company", "apiKey": "<unchanged>", "apiSecret": "<NEW secret, shown once>" }, "statusCode": 200 }

data also carries a message string confirming the rotation and reminding you to update your integration.

  • The API key stays the same. Only the secret changes.
  • The old secret stops working immediately, including for requests already in flight. Store the new one before you make another call.
  • If you’ve lost the current secret, you can’t call this. Email hello@edubanc.ng and Edubanc support will rotate it for you.
  • This does not change your webhook secret. That one is reissued by PUT /api/partner/webhook.

Rotating in production cuts off every server still using the old secret. Coordinate a maintenance window, or be ready to deploy the new secret straight away.

Receiving events

Edubanc sends a POST with a JSON body to your URL. Respond with any 2xx to acknowledge.

HeaderValue
X-EdPay-EventEvent type, e.g. loan.terms_offered
X-EdPay-Signaturesha256=<hex>
Content-Typeapplication/json

The webhook secret itself is never sent. Only the signature is.

  • A non-2xx response or a timeout (10 seconds) is retried up to 5 times with exponential backoff, after which delivery stops for that event.
  • Respond 2xx quickly and process asynchronously.
  • Events are sent after the change is saved, so you never hear about something that didn’t persist.

Who receives what

You receive events for loans and requests that are attributed to you (submitted through your parents or your API) or that belong to a school you have linked. Each partner gets each event once, even when both apply.

Events

Every payload has eventType (the same value as X-EdPay-Event) and occurredAt (UTC).

Loan request events

EventWhen
loan_request.receivedRequest submitted.
loan_request.under_reviewRequest is being reviewed.
loan_request.approved_for_bookingRequest approved, ready to become a loan.
loan_request.bookedRequest became a loan (loanId is set).
loan_request.rejectedRequest rejected (see rejectionReason).
loan_request.withdrawnRequest withdrawn. Reserved, not sent yet.
{ "eventType": "loan_request.booked", "loanRequestId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "referenceNumber": "LR-20261007-0007", "loanId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "externalSchoolId": "SCHOOL-001", "externalStudentId": "STU-2025-001", "status": "Booked", "rejectionReason": null, "requestedAmount": 150000.00, "tenureMonths": 6, "occurredAt": "2026-10-07T09:30:00Z" }

Loan events

EventWhen
loan.submittedLoan application submitted.
loan.under_reviewLoan under review.
loan.pending_manual_reviewLoan needs manual review.
loan.approvedLoan approved.
loan.rejectedLoan rejected.
loan.cancelledLoan cancelled, by the parent or by you.
loan.terms_offeredLoan terms sent. Respond via POST /api/partner/loans/{loanId}/offer/respond.
loan.terms_acceptedTerms accepted.
loan.terms_rejectedTerms rejected (the loan goes back to review).
loan.mandate_activatedDirect-debit mandate is active.
loan.mandate_failedMandate setup failed.
loan.insurance_paidInsurance fee recorded as paid.
loan.disbursedLoan disbursed to the school.
loan.repayment_receivedAn installment was paid. outstandingBalance is after this payment.
loan.repayment_failedA debit failed and will be retried.
loan.repayment_overdueRetries exhausted, installment unpaid.
loan.fully_repaidLoan fully repaid.
loan.defaultedLoan defaulted. Reserved, not sent yet.
{ "eventType": "loan.disbursed", "loanId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "applicationNumber": "LN-20261007-0001", "externalSchoolId": "SCHOOL-001", "externalStudentId": "STU-2025-001", "status": "Disbursed", "isMandateSetup": true, "isDisbursed": true, "outstandingBalance": 150000.00, "occurredAt": "2026-10-07T09:30:00Z" }

externalSchoolId is null if you have no school link for that school (referral only).

Wire names are stable. Edubanc adds new events rather than renaming existing ones, so ignore event types you don’t recognise instead of failing.

Verifying the signature

Follow the four steps in Checking an event, step by step: hash the raw request body bytes with your webhook secret, write the result as lowercase hex, and compare it to the value after sha256= in constant time.

Node.js

const crypto = require("crypto"); function isValid(rawBody, header, secret) { const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex"); const a = Buffer.from(expected); const b = Buffer.from(header || ""); return a.length === b.length && crypto.timingSafeEqual(a, b); }

C#

static bool IsValid(byte[] rawBody, string header, string secret) { using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret)); var expected = "sha256=" + Convert.ToHexString(hmac.ComputeHash(rawBody)).ToLowerInvariant(); return CryptographicOperations.FixedTimeEquals( Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(header ?? "")); }

Notes

  • Events are only sent while your partner account is Active and a webhook URL is set.
  • Retries can deliver the same event more than once, and payloads carry no unique event id. Make your handler idempotent, for example by keying on eventType + loanId (or loanRequestId) + occurredAt.

Troubleshooting

ProblemLikely cause
The signature never matchesYou are hashing parsed JSON, not the raw body. Or you are using an old webhook secret after calling PUT /api/partner/webhook again.
Events stopped arrivingYour endpoint returned a non-2xx response or took over 10 seconds, 5 times. Or your account is not Active. Or no webhook URL is set.
The same event arrives twiceRetries can redeliver. Payloads have no unique id, so make the handler idempotent (key on eventType + loanId or loanRequestId + occurredAt).
The URL is rejectedIt must be https:// on a public host. localhost, private IP ranges and .internal / .local hosts are refused.

Before you go live

  • Webhook URL set with PUT /api/partner/webhook
  • Webhook secret stored in a secrets manager
  • Signature check implemented, and tested with a wrong secret to confirm it rejects
  • Handler is idempotent
  • Endpoint responds within 10 seconds