Skip to main content

Order

Handling Order Webhook Events

Overview

When a update for an order is received, our system triggers a webhook event. This event is sent as an HTTP POST request to the endpoint you have specified in the admin dashboard.

Setting Up the Webhook Endpoint

  • Endpoint Configuration: Define the endpoint in the admin dashboard where webhook events will be sent.
  • Security Measures: Ensure your endpoint is secure and can validate the authenticity of the webhook events received. The Authorization header will contain the token configured in your webhook settings.

Handling the paymentStatus

  • PAID: The payment from the customer has been successfully processed.
  • PENDING: The payment has not yet been completed. Implement appropriate logic to handle incomplete or failed payments.

note: having a payment status of PAID does not always mean you the seller also got paid. Payment happends when order is marked as delivered in the Sevi system.

Best Practices

  • Logging: Keep logs of the webhook events for troubleshooting and auditing purposes.
  • Idempotency: Ensure your webhook handling logic is idempotent to avoid duplicate processing in case of multiple event deliveries.
  • Timely Processing: Process webhook events promptly to maintain up-to-date order status in your system.
  • Return a 200/201 status: The webhook will retry up to 3 times with exponential backoff if a non-200/201 response is returned.

Payload Reference

The webhook sends a JSON body with two top-level keys: order and customer.

{
"order": { ... },
"customer": { ... }
}

order

Always present. Contains the order details and related information.

FieldTypeDescription
idstringOrder ID
referenceNumberstring | nullUnique order reference (e.g. ORD-123456)
platformReferencestring | nullExternal platform reference
platformIdstring | nullExternal platform ID
vendorIdstring | nullVendor wallet account
customerIdstring | nullCustomer wallet account
statusstring | nullPENDING, AWAITING_SHIPMENT, DELIVERED, ARCHIVED
paymentStatusstringPENDING, PAID
paymentMethodstring | nullSEVI_PAY, SEVI_WALLET, etc.
amountnumberOrder amount
originalAmountnumberOriginal amount before discount
discountnumberDiscount applied
fixedVatnumberFixed VAT amount
percentageVatnumberPercentage VAT
rewardAmountnumberReward amount
currencystring | nullKES, UGX, USD
namestring | nullOrder name / description
phoneNumberstring | nullCustomer phone number on the order
notesstring | nullOrder notes
itemsjson | nullOrder line items (shape varies by platform)
ecommercePlatformstring | nullSEVI, WOOCOMMERCE, etc.
creditConfigurationIdstring | nullCredit configuration used
paymentReferenceNumberstring | nullPayment workflow reference
returnURLstring | nullReturn URL after payment
deliverDirectboolean | nullWhether order is delivered directly
createdByCustomerboolean | nullWhether order was created by the customer
createdAtdatetimeCreation timestamp
approvedByVendordatetime | nullWhen approved by vendor

order.shipping

Shipping / delivery address. null if not provided.

FieldTypeDescription
idstringShipping address ID
firstNamestring | nullFirst name
lastNamestring | nullLast name
companystring | nullCompany name
address1string | nullAddress line 1
address2string | nullAddress line 2
landmarkstring | nullLandmark
citystring | nullCity
statestring | nullState / province
postcodestring | nullPostal code
countrystring | nullCountry code
emailstring | nullEmail
phoneNumberstring | nullPhone number
longitudestring | nullGPS longitude
latitudestring | nullGPS latitude
shippingTypestring | nullShipping type
shippingFeenumber | nullShipping fee
isDefaultboolean | nullWhether this is the default address
createdAtdatetime | nullCreation timestamp

order.billing

Billing address. null if not provided.

FieldTypeDescription
idstringBilling address ID
firstNamestring | nullFirst name
lastNamestring | nullLast name
companystring | nullCompany name
address1string | nullAddress line 1
address2string | nullAddress line 2
citystring | nullCity
statestring | nullState / province
postcodestring | nullPostal code
countrystring | nullCountry code
emailstring | nullEmail
phoneNumberstring | nullPhone number

customer

Customer details as known by the vendor. null if the customer/vendor relationship is not found.

FieldTypeDescription
namestring | nullCustomer name
emailstring | nullCustomer email
referencestring | nullCustomer reference in the vendor's system
phoneNumbersstring[]Customer phone numbers

Full Example

{
"order": {
"id": "01234567-abcd-...",
"referenceNumber": "ORD-123456",
"platformReference": null,
"platformId": null,
"vendorId": "WAL-vendor-...",
"customerId": "WAL-buyer-...",
"status": "DELIVERED",
"paymentStatus": "PAID",
"paymentMethod": "SEVI_PAY",
"amount": 5000.00,
"originalAmount": 5000.00,
"discount": 0.00,
"fixedVat": 0.00,
"percentageVat": 0.00,
"rewardAmount": 0.00,
"currency": "KES",
"name": "Order for Widget",
"phoneNumber": "+254712345678",
"notes": null,
"items": [
{
"id": "...",
"name": "Widget",
"price": 5000,
"quantity": 1
}
],
"ecommercePlatform": "SEVI",
"creditConfigurationId": "01234567-...",
"paymentReferenceNumber": "wf-...",
"returnURL": null,
"deliverDirect": false,
"createdByCustomer": false,
"createdAt": "2025-01-15T09:00:00.000Z",
"approvedByVendor": "2025-01-15T09:05:00.000Z",
"shipping": {
"id": "01234567-abcd-...",
"firstName": "John",
"lastName": "Doe",
"company": null,
"address1": "123 Main St",
"address2": null,
"landmark": "Near the market",
"city": "Nairobi",
"state": "Nairobi",
"postcode": "00100",
"country": "KE",
"email": "john@example.com",
"phoneNumber": "+254712345678",
"longitude": "36.8219",
"latitude": "-1.2921",
"shippingType": null,
"shippingFee": null,
"isDefault": true,
"createdAt": "2024-08-01T00:00:00.000Z"
},
"billing": {
"id": "01234567-abcd-...",
"firstName": "John",
"lastName": "Doe",
"company": null,
"address1": "123 Main St",
"address2": null,
"city": "Nairobi",
"state": "Nairobi",
"postcode": "00100",
"country": "KE",
"email": "john@example.com",
"phoneNumber": "+254712345678"
}
},
"customer": {
"name": "John Doe",
"email": "john@example.com",
"reference": "CUS018082",
"phoneNumbers": ["+254712345678"]
}
}