.NET
Webhooks with the .NET SDK
When a customer pays, IZI Pay sends a notification to the webhook URL you gave during onboarding. IziPayWebhooks helps you:
- check that the notification really comes from IZI Pay;
- read it into a typed object;
- answer in the exact format IZI Pay expects.
How delivery and retries work is explained in Webhooks.
Set up
During onboarding you chose an Access-Key: a secret that IZI Pay sends in the Access-Key header of every notification. Give the same value to the SDK.
C#
Receive a payment by reference
C#
A reference notification contains:
| Field | Meaning |
|---|---|
Id | IZI Pay's ID for this notification. Use it to ignore repeats |
Reference | The reference that was paid |
AmountPaid | Amount paid, in kwanzas |
PaidAt | When the customer paid |
TransactionId, SystemLogNumber, SystemLogId | Transaction identifiers, useful for reconciliation |
TerminalType, TerminalId, TerminalLocation | Where the customer paid, for example an ATM |
Nib, Bank | The payer's account and bank, when sent |
Receive a QR Code payment
Same steps, on your QR Code webhook URL:
C#
Answer
| Call | When | IZI Pay then |
|---|---|---|
IziPayWebhooks.Acknowledge(orderId) | You handled it, or had already handled it before | Stops sending it |
IziPayWebhooks.Acknowledge(orderId, "Payment already processed") | Same, with your own note | Stops sending it |
IziPayWebhooks.Reject(orderId, "Database unavailable") | You could not handle it now | Sends it again later |
The first argument is required: your own ID for the order or payment. The note is optional.
Always answer Acknowledge for a repeat you already handled. Answering an error makes IZI Pay keep resending it.
Other checks
webhooks.EnsureAuthentic(header)does the same asIsAuthenticbut throwsIziPayWebhookExceptionwhen the key is wrong.ParseReferencePaymentandParseQrCodePaymentthrowIziPayWebhookExceptionwhen the body is empty or is not a valid notification. Answer HTTP 400 in that case.- The key is compared in a way that takes the same time whether it is right or wrong, so it cannot be guessed by measuring answers.
Last modified on