Instalment App API

Reference for the salesperson, customer and dealer apps · base URL https://vivo.websacco.com · 73 endpoints · 22 October 2026

Download Postman collection

Every example under a Built endpoint was recorded from the running API: the sample request, curl and response are exactly what was sent and returned. Real keys appear as YOUR_API_KEY.

How every call works

Every endpoint is POST https://vivo.websacco.com/api/<module>/<method>.

JSON requests send request_id, api_key and data:

JSON body
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}

Photo uploads (profile photo, customer documents, IMEI label, handover photos) are multipart/form-data: request_id, api_key, user_id and the other fields as form fields, the photo in a field named file (JPEG or PNG, max 5 MB). A form field holding JSON, such as device, is decoded.

FieldMeaning
api_keyIdentifies the app. Issued and revoked by head office; only its hash is stored. Sandbox keys (ak_test_…) use the SMS code 123456 and return it as debug_code.
request_idA number the app sends with each call, for tracing
user_idThe person using the app, returned by login. Required on every call except check_account, login, forgot_password, resend_reset_code, verify_reset_code and reset_password.
idempotency_keyA UUID on calls that create money or state (submit_application, create_order, request_deposit, record_handover); a retry returns the first answer

Answers come back with HTTP 200; check status (1 success, 0 refused) and branch on error_code. The Users API puts fields directly in response; Customers and Orders put them in response.data and add http_status on a refusal. Phones are accepted as 07…, 7…, 2547… or +254 7… and returned as 2547…; amounts are whole Kenyan shillings; times are ISO 8601 with +03:00.

Checks before any method runs

A refusal here uses the short shape {"code": "API006", "description": "Invalid API key."}.

CodeMeaning
API001Empty body
API002Body (or the data form field) is not valid JSON
API005Missing api_key
API006Unknown or wrong API key
API007API key revoked or expired
API008API key not allowed from this IP address
API009API key not allowed to call this module
API003Missing request_id
API004Missing data
API010Missing or invalid user_id (not needed before login)
API011No user with that user_id
API012User account deactivated

The journey

  1. Log in — users/check_account → users/login. First time or forgotten password: users/forgot_password → users/verify_reset_code → users/reset_password.
  2. Find or add the customer — customers/lookup_customer → customers/create_customer.
  3. Verify — customers/send_customer_otp → verify_customer_otp, save_profile (creates the customer's app login), upload_document ×3, save_consents.
  4. Apply — customers/submit_application → poll customers/get_application until approved.
  5. Device — devices/get_catalogue (what fits the limit) → devices/get_quote → orders/create_order → orders/upload_imei_photo (Claude reads the IMEI) → orders/confirm_imei.
  6. Deposit — orders/request_deposit (M-Pesa STK) → poll orders/deposit_status.
  7. Agreement — orders/generate_agreement → send_sign_code → sign_agreement.
  8. Hand over — orders/start_activation → (status 9 only: verify_activation_code) → poll activation_status until next is handover_photos → upload_handover_photo ×4 → record_handover. See Activation and handover flow.
  9. Customer app — the customer logs in with their ID number and sees the device, countdown, balance and agreement.

Activation and handover flow

Step 4 of the salesperson app, Activate & hand over: from a signed agreement to a handed-over phone. The app only calls our API; our server signs and encrypts every VTrust request (SHA-256 signature with the clientSecret, body AES-128-GCM with the aesKey and aesIv) through the Vtrust_api library. Endpoints marked Design · to build below are the agreed design for locking_mode = vtrust; the recorded samples under 8.1 and 8.2 come from the mock locking layer.

The screens

Screens 3 and 3e are only for phones VTrust reports as unauthorized (status 9). Phones in our import go straight from Screen 2 to Screen 4. our API VTrust

Screen 1: Not started
Screen 1Not startedThe phone must be on and online. Photos and Complete handover stay off.get_order
Screen 2: Enrolling
Screen 2EnrollingOur API enrols IMEI1 with VTrust and reads its status. Buttons show Please wait… and are locked.start_activationdevice/createdevice/info
Screen 3 · status 9: Enter the code from the phone
Screen 3 · status 9Enter the code from the phoneThe phone shows a 6-digit code. The salesperson types it in and taps Confirm code.verify_activation_codedevice/verify-auth-code
Screen 3e: Wrong code
Screen 3eWrong codeVTrust rejects the code. The boxes turn red; the salesperson checks the phone and retries, or sends a new code.resend_activation_codedevice/send-auth-code
Screen 4 · status 8: Waiting for the device
Screen 4 · status 8Waiting for the deviceNothing to type. The app polls every 5 s; VTrust Guard activates the phone once it is online.activation_statusdevice/infowebhook
Screen 5: Active
Screen 5ActiveVTrust reports Active. The lock date shows, and the photo rows switch on.activation_statusdevice/remind-message
Screen 6: Four photos taken
Screen 6Four photos takenEach photo is taken live and uploaded on its own. At 4 of 4, Complete handover turns on.upload_handover_photo ×4
Screen 7: Before you hand over
Screen 7Before you hand overA sheet with the five education topics. Record handover stays off until all are ticked.record_handover
Screen 8: Handover complete
Screen 8Handover completeThe plan is active, the customer has the welcome SMS, and the order is closed.

Screen transitions

FromToTrigger
1 Not started2 EnrollingTap Enrol device
2 Enrolling3 Enter the codenext = enter_auth_code (VTrust status 9)
2 Enrolling4 Waitingnext = wait_online (status 8)
3 Enter the code4 WaitingCode accepted (next = wait_online)
3 Enter the code3e Wrong codeAUTH_CODE_WRONG
3e Wrong code3 Enter the codeNew code sent, or the salesperson edits the code
4 Waiting5 Activenext = handover_photos (status 1)
5 Active6 Photos takenFourth photo saved
6 Photos taken7 ChecklistTap Complete handover
7 Checklist8 CompleteAll five ticked, record_handover succeeds

Code boxes: digits only, focus moves to the next box as you type, pasting six digits fills all six, Confirm code is off until six digits are in, Send a new code is off for 60 seconds after each send. The code is never stored on our side.

The next field

start_activation, activation_status, verify_activation_code and resend_activation_code all return next. The app draws the enrol card from it and never reads activation_code in VTrust mode.

nextScreenWhat the app does
wait_online4 WaitingShow Waiting for the device… with the tips; keep polling activation_status every poll_every_seconds.
enter_auth_code3 Enter the codeShow six code boxes; Confirm code calls verify_activation_code; Send a new code calls resend_activation_code (off for resend_after_seconds).
handover_photos5 ActiveStop polling; show the lock date; switch on the four photo rows.
call_head_officeProblem cardStop polling; show message and the head office number. Used for a locked phone, DEVICE_NOT_IN_SCOPE and AUTHORISATION_LIMIT.

Chip, order status and VTrust status

Chip on the cardOrder statusVTrust statusnextPhotosComplete handover
Not startedsigned––OffOff
Code neededactivating9 unauthorizedenter_auth_codeOffOff
Inactivatedactivating8 unactivatedwait_onlineOffOff
Activeready_for_handover1 active · 2 normalhandover_photosOnOn at 4 of 4
Lockedactivating3 locking · 4 locked · 10/11 progressivecall_head_officeOffOff
Handed overhanded_over1 active–Read-onlyDone

Call by call

  1. App → our API: start_activation {order_id}
  2. Our API → VTrust: device/create {deviceId=IMEI1, lockTime, messages, deviceLabelId}; VTrust answers code 0 (or "device already exists", treated as done)
  3. Our API → VTrust: device/info {deviceId}; VTrust answers status 8 (unactivated) or 9 (unauthorized)
  4. Our API → app: next = wait_online or enter_auth_code
  5. Status 9 only: the handset shows a code; app → our API verify_activation_code {order_id, auth_code} → VTrust device/verify-auth-code → status 8. If the code expired or never showed: resend_activation_code → VTrust device/send-auth-code
  6. Handset online; VTrust Guard confirms activation; VTrust pushes deviceStatusChange (newStatus ACTIVE) to POST /orders/callbacks/vtrust
  7. App polls activation_status every 5 s, up to 3 minutes; our API calls device/info only if no push has arrived for 10 s; answers next = handover_photos
  8. Our API → VTrust: device/remind-message (welcome and first lock date)
  9. App → our API: upload_handover_photo ×4, then record_handover; plan active, welcome SMS
#Salesperson doesApp callsOur API doesVTrustOn screen
1Turns the phone on, connects it to Wi-Fi or data–––Screen 1
2Taps Enrol devicestart_activationChecks the order is signed. Works out the lock time from the days credited at handover. Saves the request; order → activatingdevice/create, device/infoScreen 2, then 3 or 4
2aStatus 9 only: types the code the phone showsverify_activation_code (resend_activation_code if needed)Passes the code to VTrust; never stores itdevice/verify-auth-code (device/send-auth-code)Screen 3 → 4, or 3e
3Waits; nothing to typeactivation_status every 5 sAnswers from the order (kept current by the webhook); asks VTrust only if nothing has arrived for 10 sdevice/info, webhookScreen 4 until Active
4–(poll returns Active)Order → ready_for_handover; activated_at saveddevice/remind-message (welcome)Screen 5: photos unlocked
5Takes the four photos with the cameraupload_handover_photo ×4Refuses gallery photos; saves each with size, time and checksum; a retake replaces that photo–Screen 6: 4 of 4
6Goes through the five topics, taps Record handoverrecord_handoverNeeds Active + 4 photos + all 5 topics. Creates the plan (active, days credited), unit → on_plan, stock issued; welcome SMS–Screens 7 → 8

VTrust lock flow

What our API sends to VTrust. Every request is POST https://{domain}/openapi/v2/{manufacturer}/… with the headers -x-vtrust-transactionId, -x-vtrust-clientId, -x-vtrust-timestamp (ms) and -x-vtrust-signature (plus -x-vtrust-region if VTrust asks for it), and the encrypted body as the form field param.

Our callVTrust endpointBody (before encryption)When
start_activationdevice/createdeviceId, lockTime, lockTimeDelayPeriod, remindBeforePhoneLock, warnMsgBeforeLocked, warnMsgAfterLocked, deviceLabelIdOnce per order; "device already exists" counts as done
start_activationdevice/infodeviceIdStraight after create, to choose screen 3 or 4
verify_activation_codedevice/verify-auth-codedeviceId, authCodeStatus 9 only
resend_activation_codedevice/send-auth-codedeviceIdAt most once a minute
activation_statusdevice/infodeviceIdOnly if no webhook update for 10 s
On Activedevice/remind-messagedeviceId, msgTitle, msgContentOnce: welcome and first lock date

VTrust status → our answer.

VTrust statusNameprovider_statenext
9unauthorizedUnauthorizedenter_auth_code
8unactivatedInactivatedwait_online
1activeActivehandover_photos
2normalActivehandover_photos
3lockingLockedcall_head_office
4lockedLockedcall_head_office
5unlockingUnlockingwait_online
7completingReleasedcall_head_office
6completedReleasedcall_head_office
10 / 11progressiveLockedcall_head_office
-1unknownUnknownwait_online

Device lifecycle (VTrust Open API v2.3.9, page 7).

FromToCaused by
(new)unactivateddevice/create, phone in our import
(new)unauthorizeddevice/create, phone outside our import
unauthorizedunactivateddevice/verify-auth-code
unactivatedactivePhone online, activation confirmed
activelocking → lockedcontrol type 1, or lockTime reached; device confirms
lockedunlocking → activecontrol type 2, or type 3 with a new lockTime; device confirms
active / lockedcompleting → completeddevice/complete-contract; device confirms
completedremoveddevice/remove

Lock settings at enrolment.

VTrust fieldValue we sendWhere it comes from
deviceIdIMEI1The IMEI confirmed against the store's sellable list
lockTimeEnd of the last paid-up day, 23:59 EAT, in epoch millisecondsDays credited at handover (days_credited_at_handover, default 1)
remindBeforePhoneLock720 minutes (12 hours)Configurable lock timing
warnMsgBeforeLocked"Your phone locks tonight at 23:59. Pay KES 68 to Paybill [our Paybill], account [your number]."Template, with the daily amount
warnMsgAfterLocked"This phone is locked. Pay your instalment to unlock it. Help: [support number]."Template
lockTimeDelayPeriod0: an offline unlock PIN doesn't re-lock by itselfErroneous-lock service records control the expiry instead (scope item 22)
deviceLabelIdOur label for this programmeFrom VTrust with the credentials

After handover: keeping the lock date right.

EventWhat our server doesVTrust call
Instalment paidAdds the days bought to the plan and moves the lock date forwarddevice/control type 3 (lockTime)
Paid while lockedSets the new lock date, which unlocks the phonedevice/control type 3 (or type 2, then type 3)
Reminder before the lock dateMessage on the phone, on top of VTrust's own warningdevice/remind-message
Erroneous lock, phone offlineService record with operator, reason and expiry; no re-lock while opendevice/unlock-pin · device/query-sms-unlock-pin
Plan fully paidPermanent release. Not reversibledevice/complete-contract
Device changes stateOrder and plan updated from the pushwebhook deviceStatusChange

When something goes wrong

Situationerror_codehttp_statusWhat the salesperson sees
Agreement not signed yetAGREEMENT_NOT_EXECUTED409"Sign the agreement before enrolling the phone."
VTrust doesn't answer, times out or returns 5xxLOCKING_UNAVAILABLE502"Enrolment isn't available right now. Try again in a minute." Order stays signed
"This device is not within the import scope of your account"DEVICE_NOT_IN_SCOPE422"This phone isn't registered for instalments. Call head office." Head office imports the IMEI in the VTrust console
"Mes do not exist"DEVICE_NOT_RECOGNISED422"VTrust doesn't recognise this IMEI. Check the phone is genuine and the IMEI matches the box."
"Authentication code does not match"AUTH_CODE_WRONG401"That code doesn't match the phone. Check and try again."
Too many wrong codesAUTH_CODE_LOCKED429"Too many tries. Send a new code."
New code asked for within 60 sTOO_SOON409Send a new code stays off; retry_after_seconds says how long
Code sent when the phone doesn't need oneAUTH_CODE_NOT_NEEDED409Nothing; the app follows next from the response
"The number of unauthorized devices exceeds the limit"AUTHORISATION_LIMIT409"Head office must clear pending phones before more can be added."
"device already exists" / "The device is authenticated"(none)–Nothing; the API reads the current status and carries on
Still Inactivated after 3 minutesACTIVATION_TIMEOUT409"The phone hasn't connected yet. Check it's online and the date and time are right." Check again resumes polling
Photo picked from the galleryGALLERY_NOT_ALLOWED422"Take the photo with the camera."
Photo before the phone is ActiveACTIVATION_PENDING409"Wait for the phone to show Active."
Complete handover with a topic untickedCHECKLIST_INCOMPLETE422"Go through every topic with the customer." The missing topics are listed
Complete handover with photos missingEVIDENCE_MISSING422"Take all four handover photos first."
Webhook with a bad signature, or older than 5 minutesSIGNATURE_INVALID401Server to server only; VTrust retries

Rules

  • Order of events (scope item 14): signature, deposit by STK Push, activation, photos, handover. Today the deposit comes before the signature; that change sits in the order flow, before this screen.
  • Photos only once Active. upload_handover_photo is refused with ACTIVATION_PENDING until the order is ready_for_handover, matching the screen.
  • Locking layer: locking_mode = vtrust, with Order_locking calling the Vtrust_api library. mock stays for demos and returns the activation_code shown in the recorded samples.
  • One enrolment per order. A second tap on Enrol device returns the current state; "device already exists" from VTrust counts as enrolled.
  • Secrets (clientSecret, aesKey, aesIv, webhook secretKey) live only in the server environment (VTRUST_*). Each VTrust call is logged to device_locking_log without secrets, signatures, codes or PINs.

To confirm with VTrust before build

  • Whether a phone in our import ever shows the authorisation code, how long a code stays valid, and how many attempts it allows.
  • Whether setting a new lockTime (type 3) on a locked phone unlocks it straight away.
  • How long an unlock PIN stays valid.

Error codes

http_statusCodesMeaning
400VALIDATION_FAILEDA field is missing or wrong; see field_errors / validation_errors
401INVALID_CREDENTIALS, WRONG_PASSWORD, OTP_INVALID, RESET_CODE_INVALID, AUTH_CODE_WRONG, SIGNATURE_INVALIDWrong password or code
403ACCOUNT_DISABLED, ROLE_NOT_ALLOWED, SALESPERSON_NOT_FOUND, FORBIDDEN, CUSTOMER_BLOCKEDNot allowed for this login, app or record
404ACCOUNT_NOT_FOUND, CUSTOMER_NOT_FOUND, APPLICATION_NOT_FOUND, ORDER_NOT_FOUND, RESET_NOT_FOUND, NO_DEPOSIT_REQUESTNo such record
409CUSTOMER_EXISTS, NATIONAL_ID_IN_USE, APPLICATION_PENDING, ALREADY_APPROVED, COOLING_OFF, ACTIVE_PLAN_EXISTS, OPEN_ORDER_EXISTS, OUT_OF_STOCK, IMEI_IN_USE, IMEI_WRONG_MODEL, DEPOSIT_NOT_PAID, DEPOSIT_ALREADY_PAID, DEPOSIT_IN_PROGRESS, IMEI_NOT_CONFIRMED, AGREEMENT_NOT_READY, AGREEMENT_NOT_EXECUTED, ACTIVATION_PENDING, ACTIVATION_NOT_STARTED, ORDER_STATE, TOO_SOON, AUTH_CODE_NOT_NEEDED, AUTHORISATION_LIMIT, ACTIVATION_TIMEOUTClashes with the current state
410OTP_EXPIRED, RESET_CODE_EXPIRED, RESET_TOKEN_INVALID, ORDER_EXPIRED, CODE_EXPIREDToo late; restart that step
413FILE_TOO_LARGEPhoto over 5 MB
422PASSWORD_TOO_WEAK, PASSWORD_NOT_SET, CUSTOMER_NOT_VERIFIED, CONSENT_MISSING, STATEMENT_CODE_INVALID, NOK_SAME_AS_CUSTOMER, PHONE_INVALID, NATIONAL_ID_INVALID, NO_APPROVED_LIMIT, OVER_LIMIT, DEPOSIT_OUT_OF_RANGE, DEPOSIT_NOT_OWN_NUMBER, GALLERY_NOT_ALLOWED, FILE_MISSING, FILE_INVALID, DOC_TYPE_INVALID, KIND_INVALID, IMEI_INVALID, IMEI_MISMATCH_OCR, EVIDENCE_MISSING, CHECKLIST_INCOMPLETE, READ_NOT_CONFIRMED, REASON_REQUIRED, DEVICE_NOT_IN_SCOPE, DEVICE_NOT_RECOGNISEDA business rule says no
429ACCOUNT_LOCKED, TOO_MANY_REQUESTS, OTP_LOCKED, RESET_CODE_LOCKED, AUTH_CODE_LOCKEDSlow down; retry_after_seconds when given
502MPESA_UNAVAILABLE, LOCKING_UNAVAILABLEA partner service didn't answer; retry

Postman collection

All 73 requests, one folder per module, with sample photos picked in the form-data file field and test scripts that carry user_id, customer_id, order_id, codes and tokens from one request to the next.

Download Postman collection

  1. In Postman: Import → choose the downloaded file.
  2. Open the collection's Variables and set api_key to your key (a sandbox key ak_test_… fills SMS codes in automatically). site_url is already https://vivo.websacco.com.
  3. Run Users → 1.2 Log in first; it saves user_id for every later request.

Users API

Built

POST https://vivo.websacco.com/api/users/<method>

Log in with the national ID number and a password; forgot and reset password by SMS code; profile and account. The ID number finds the account, the account's phone receives every code, and ion_auth->login($user->phone, $password) checks the password. Login returns user_id and the flags is_dealer, is_salesperson, is_customer; each app accepts its own role. Answers keep the users style: fields directly in response, refusals with error_code and form errors in validation_errors.

1.1 Check account (ID number)

POST/api/users/check_account

Log in and password

Returns the masked phone, has_password and next (login or set_password).

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/check_account" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Enter your password.",
    "account_found": true,
    "first_name": "Grace",
    "phone_masked": "254745***456",
    "has_password": true,
    "locked_for_seconds": 0,
    "next": "login",
    "time": 1791300714
  }
}

1.2 Log in

POST/api/users/login

Log in and password

Saves user_id and the three role flags for every later request.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "password": "Sunrise#2026",
    "device": {
      "id": "dev_a1f3c9",
      "model": "TECNO KF6",
      "app_version": "1.4.0"
    }
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/login" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "password": "Sunrise#2026",
    "device": {
      "id": "dev_a1f3c9",
      "model": "TECNO KF6",
      "app_version": "1.4.0"
    }
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Welcome back, Grace.",
    "user_id": 7,
    "id_number": "29876543",
    "first_name": "Grace",
    "last_name": "Wambui",
    "phone": "254745123456",
    "email": "grace@example.com",
    "avatar": "",
    "last_login": "2026-10-06T18:31:54+03:00",
    "is_dealer": false,
    "is_salesperson": true,
    "is_customer": false,
    "dealer": null,
    "salesperson": {
      "id": 1,
      "staff_no": "SP-0001",
      "store": {
        "id": 1,
        "code": "NBO-001",
        "name": "Nairobi CBD"
      }
    },
    "customer": null,
    "time": 1791300714
  }
}
Sample response — customer on the customer app (home screen block)
{
  "response": {
    "status": 1,
    "message": "Welcome back, Geoffrey.",
    "user_id": 50,
    "id_number": "36955148",
    "first_name": "Geoffrey",
    "last_name": "Ongid",
    "phone": "254748974489",
    "email": "",
    "avatar": "",
    "last_login": "2026-10-06T18:32:02+03:00",
    "is_dealer": false,
    "is_salesperson": false,
    "is_customer": true,
    "dealer": null,
    "salesperson": null,
    "customer": {
      "id": 2101,
      "customer_no": "C-2101",
      "active_plan": "HP-1001",
      "plans_completed": 0,
      "plan": {
        "plan_no": "HP-1001",
        "status": "active",
        "handed_over_on": "2026-10-06T18:32:01+03:00",
        "device": {
          "name": "vivo Y28 256GB/8GB",
          "brand": "vivo",
          "model": "Y28",
          "storage_gb": 256,
          "ram_gb": 8,
          "colour": "Emerald",
          "imei_masked": "3541*******2263"
        },
        "device_state": "Active",
        "active_until": "2026-10-06T23:59:59+03:00",
        "seconds_remaining": 19677,
        "countdown": {
          "days": 0,
          "hours": 5,
          "minutes": 27,
          "seconds": 57
        },
        "locked_since": null,
        "daily_amount": 100,
        "deposit_amount": 6000,
        "total_payable": 42000,
        "amount_paid": 6000,
        "balance": 36000,
        "progress_percent": 14,
        "payment_days": 360,
        "last_payment": {
          "amount": 6000,
          "paid_at": "2026-10-06T18:32:00+03:00",
          "mpesa_receipt": "S000TMAER7",
          "type": "deposit"
        },
        "agreement": {
          "agreement_no": "HP-1001",
          "download_url": "https://vivo.websacco.com/orders/api_files/agreement/HP-1001/1791301322-4fb7dd25e3fab07849b4abfa",
          "link_expires_in": 600
        },
        "how_to_pay": {
          "paybill": null,
          "account_number": "36955148",
          "ussd": null
        }
      }
    },
    "time": 1791300722
  }
}

1.2x Wrong password is refused

Refusal example
POST/api/users/login

Log in and password

Expected: INVALID_CREDENTIALS. Five of these lock the account for 15 minutes.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "password": "wrong-pass1"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/login" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "password": "wrong-pass1"
  }
}'
Sample response
{
  "response": {
    "status": 0,
    "error_code": "INVALID_CREDENTIALS",
    "message": "Wrong ID number or password.",
    "time": 1791300715
  }
}

1.3 Forgot password: send code

POST/api/users/forgot_password

Log in and password

Sends a 6-digit code to the phone on the account. With a sandbox key (ak_test_…) the code is 123456 and is saved to reset_code; otherwise type the SMS code into reset_code.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/forgot_password" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "We have sent a 6-digit code to 254745***456.",
    "reset_ref": "rst_63909a0846",
    "purpose": "forgot_password",
    "phone_masked": "254745***456",
    "expires_in": 600,
    "resend_after": 60,
    "debug_code": "123456",
    "time": 1791300715
  }
}

1.4 Resend code

Refusal example
POST/api/users/resend_reset_code

Log in and password

Allowed 60 seconds after 1.3; sooner it answers TOO_SOON (the test accepts both).

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_ref": "rst_63909a0846"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/resend_reset_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_ref": "rst_63909a0846"
  }
}'
Sample response
{
  "response": {
    "status": 0,
    "error_code": "TOO_SOON",
    "message": "Wait a minute before asking for another code.",
    "time": 1791300715
  }
}

1.5 Verify code

POST/api/users/verify_reset_code

Log in and password

Saves the one-time reset_token.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_ref": "rst_63909a0846",
    "code": "123456"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/verify_reset_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_ref": "rst_63909a0846",
    "code": "123456"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Code confirmed. Choose your new password.",
    "reset_token": "d87f9bd97d6d2757bfcd27561f9cdce9a2b3658bbd7f83e7",
    "expires_in": 900,
    "time": 1791300715
  }
}

1.6 Set new password

POST/api/users/reset_password

Log in and password

Then set password to new_password and log in again.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_token": "d87f9bd97d6d2757bfcd27561f9cdce9a2b3658bbd7f83e7",
    "new_password": "Harvest#2026",
    "confirm_password": "Harvest#2026"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/reset_password" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "id_number": "29876543",
    "reset_token": "d87f9bd97d6d2757bfcd27561f9cdce9a2b3658bbd7f83e7",
    "new_password": "Harvest#2026",
    "confirm_password": "Harvest#2026"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Password changed. Log in with your new password.",
    "next": "login",
    "time": 1791300715
  }
}

Get profile

POST/api/users/get_profile

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/get_profile" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "user_id": 7,
    "id_number": "29876543",
    "first_name": "Grace",
    "last_name": "Wambui",
    "phone": "254745123456",
    "email": "grace@example.com",
    "avatar": "",
    "last_login": "2026-10-06T18:31:54+03:00",
    "is_dealer": false,
    "is_salesperson": true,
    "is_customer": false,
    "dealer": null,
    "salesperson": {
      "id": 1,
      "staff_no": "SP-0001",
      "store": {
        "id": 1,
        "code": "NBO-001",
        "name": "Nairobi CBD"
      }
    },
    "customer": null,
    "time": 1791300716
  }
}

Change password

POST/api/users/change_password

Profile and account

Uses password as the current one.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "old_password": "Harvest#2026",
    "new_password": "Morning#2026",
    "confirm_password": "Morning#2026"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/change_password" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "old_password": "Harvest#2026",
    "new_password": "Morning#2026",
    "confirm_password": "Morning#2026"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Password changed.",
    "time": 1791300716
  }
}

Update name

POST/api/users/update_name

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "name": "Grace Njeri Wambui"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/update_name" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "name": "Grace Njeri Wambui"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Successful",
    "first_name": "Grace Njeri",
    "last_name": "Wambui",
    "time": 1791300716
  }
}

Update email

POST/api/users/update_email

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "email": "grace@example.com"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/update_email" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "email": "grace@example.com"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "email": "grace@example.com",
    "message": "Success",
    "time": 1791300716
  }
}

Change phone: send code to new number

POST/api/users/change_user_phone_number

Profile and account

A 4-digit code goes to the new phone. Sandbox keys save it to change_code.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "new_phone": "0711222333"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/change_user_phone_number" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "new_phone": "0711222333"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "successful",
    "new_phone_masked": "254711***333",
    "debug_code": "7866",
    "time": 1791300716
  }
}

Change phone: resend code

POST/api/users/resend_code

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254745123456",
    "new_phone": "0711222333"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/resend_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254745123456",
    "new_phone": "0711222333"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "successful",
    "debug_code": "9502",
    "time": 1791300716
  }
}

Change phone: verify code

POST/api/users/verify_code

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254745123456",
    "new_phone": "0711222333",
    "code": "9502"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/verify_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254745123456",
    "new_phone": "0711222333",
    "code": "9502"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Successfully updated user phone number",
    "phone": "254711222333",
    "time": 1791300716
  }
}

Profile photo

POST/api/users/edit_profile_photo

Profile and account

JPEG or PNG, max 5 MB. Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/edit_profile_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "successful",
    "avatar": "avatar_7_b3f18f0763cc.jpg",
    "time": 1791300716
  }
}

Update push token

POST/api/users/update_user_mobile_token

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "mobile_token": "fcm-sample-token"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/update_user_mobile_token" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "mobile_token": "fcm-sample-token"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Token successfully updated",
    "time": 1791300716
  }
}

Log out

POST/api/users/logout

Profile and account

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/users/logout" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Logged out.",
    "time": 1791300716
  }
}

Customers API

Built

POST https://vivo.websacco.com/api/customers/<method>

Find or add the customer (phone and national ID), the four checks (mobile code, profile with next of kin, three live photos, consents), then the application. Saving the profile creates the customer's app login the same way dealers and salespeople get theirs (added as a group member, linked in device_customers.user_id). Answers carry fields in data.

2.0 My customers

POST/api/customers/get_customers

Find or add customer

Customers registered by this salesperson, newest first, with verification, latest application, active plan and can_order. Optional: search (name, phone, ID number, customer no), stage (onboarding, awaiting_decision, approved, declined, on_plan), limit (max 100), offset.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "limit": 20,
    "offset": 0
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/get_customers" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "limit": 20,
    "offset": 0
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300717,
    "data": {
      "total": 6,
      "limit": 20,
      "offset": 0,
      "items": [
        {
          "id": 2108,
          "customer_no": "C-2108",
          "name": "Lucy Wanjiru",
          "phone_masked": "254778***234",
          "national_id": "32233445",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1056",
            "status": "submitted",
            "limit": null,
            "valid_until": null
          },
          "active_plan": null,
          "can_order": false,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        },
        {
          "id": 2107,
          "customer_no": "C-2107",
          "name": "Kevin Omondi",
          "phone_masked": "254767***123",
          "national_id": "34455667",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1055",
            "status": "approved",
            "limit": 30000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        },
        {
          "id": 2105,
          "customer_no": "C-2105",
          "name": "John Mwangi",
          "phone_masked": "254745***901",
          "national_id": "29988776",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1053",
            "status": "approved",
            "limit": 30000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        },
        {
          "id": 2103,
          "customer_no": "C-2103",
          "name": "Peter Kamau",
          "phone_masked": "254723***789",
          "national_id": "28765432",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1051",
            "status": "approved",
            "limit": 30000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        },
        {
          "id": 2102,
          "customer_no": "C-2102",
          "name": "Amina Hassan",
          "phone_masked": "254712***678",
          "national_id": "31882940",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1050",
            "status": "approved",
            "limit": 40000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        },
        {
          "id": 2101,
          "customer_no": "C-2101",
          "name": "Geoffrey Ongid",
          "phone_masked": "254748***489",
          "national_id": "36955148",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1049",
            "status": "approved",
            "limit": 50000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        }
      ]
    }
  }
}

2.0b My customers: search and stage filter

POST/api/customers/get_customers

Find or add customer

Only approved customers (can order now) matching the search.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "search": "geoffrey",
    "stage": "approved",
    "limit": 20,
    "offset": 0
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/get_customers" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "search": "geoffrey",
    "stage": "approved",
    "limit": 20,
    "offset": 0
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300717,
    "data": {
      "total": 1,
      "limit": 20,
      "offset": 0,
      "items": [
        {
          "id": 2101,
          "customer_no": "C-2101",
          "name": "Geoffrey Ongid",
          "phone_masked": "254748***489",
          "national_id": "36955148",
          "verification": {
            "mobile": false,
            "profile": false,
            "documents": "0/3",
            "consents": false,
            "complete": false
          },
          "application": {
            "application_no": "A-1049",
            "status": "approved",
            "limit": 50000,
            "valid_until": "2026-12-01"
          },
          "active_plan": null,
          "can_order": true,
          "has_app_login": false,
          "status": "active",
          "created_at": "2026-10-06T18:31:49+03:00"
        }
      ]
    }
  }
}

2.1 Look up customer by phone

POST/api/customers/lookup_customer

Find or add customer

found: false the first time; then 2.2 registers them.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254700111222"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/lookup_customer" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254700111222"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "No customer with this number. Register them.",
    "time": 1791300717,
    "data": {
      "found": false
    }
  }
}

2.2 Create customer

POST/api/customers/create_customer

Find or add customer

Only when 2.1 returns found: false. Saves customer_id.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254700111222",
    "national_id": "31234567"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/create_customer" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "phone": "254700111222",
    "national_id": "31234567"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Customer C-2109 created. Verify their mobile next.",
    "time": 1791300717,
    "data": {
      "id": 2109,
      "customer_no": "C-2109",
      "name": "",
      "phone_masked": "254700***222",
      "verification": {
        "mobile": false,
        "profile": false,
        "documents": "0/3",
        "consents": false,
        "complete": false
      },
      "application": null,
      "active_plan": null,
      "can_order": false,
      "phone": "254700111222",
      "national_id": "31234567",
      "app_login": {
        "status": "pending",
        "user_id": null,
        "message": "The app login is created when the profile is saved."
      }
    }
  }
}

2.3 Get customer

POST/api/customers/get_customer

Find or add customer

Verification, financier card, active plan and can_order.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/get_customer" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300717,
    "data": {
      "id": 2109,
      "customer_no": "C-2109",
      "name": "",
      "first_name": "",
      "middle_name": null,
      "last_name": null,
      "phone": "254700111222",
      "national_id": "31234567",
      "date_of_birth": null,
      "town": null,
      "next_of_kin": null,
      "verification": {
        "mobile": false,
        "profile": false,
        "documents": "0/3",
        "consents": false,
        "complete": false
      },
      "missing": [
        "mobile",
        "profile",
        "documents",
        "consents"
      ],
      "financier": null,
      "active_plan": null,
      "can_order": false,
      "app_login": {
        "has_login": false,
        "user_id": null
      }
    }
  }
}

3.1 Send customer OTP

POST/api/customers/send_customer_otp

Verify and onboard

Sandbox keys return the code (123456) and save it to customer_otp_code; otherwise type the code the customer reads out.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/send_customer_otp" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Code sent to the customer.",
    "time": 1791300717,
    "data": {
      "otp_ref": "otp_980a8ea6",
      "sent_to": "254700***222",
      "expires_in": 300,
      "debug_code": "123456"
    }
  }
}

3.2 Verify customer OTP

POST/api/customers/verify_customer_otp

Verify and onboard

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "otp_ref": "otp_980a8ea6",
    "code": "123456"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/verify_customer_otp" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "otp_ref": "otp_980a8ea6",
    "code": "123456"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Mobile number verified.",
    "time": 1791300717,
    "data": {
      "verification": {
        "mobile": true,
        "profile": false,
        "documents": "0/3",
        "consents": false,
        "complete": false
      }
    }
  }
}

3.3 Save profile and next of kin

POST/api/customers/save_profile

Verify and onboard

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "national_id": "31234567",
    "first_name": "Amina",
    "middle_name": null,
    "last_name": "Hassan",
    "date_of_birth": "1999-04-17",
    "town": "Nairobi",
    "next_of_kin": {
      "name": "Halima Hassan",
      "relationship": "mother",
      "phone": "254711000999"
    }
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/save_profile" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "national_id": "31234567",
    "first_name": "Amina",
    "middle_name": null,
    "last_name": "Hassan",
    "date_of_birth": "1999-04-17",
    "town": "Nairobi",
    "next_of_kin": {
      "name": "Halima Hassan",
      "relationship": "mother",
      "phone": "254711000999"
    }
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Profile saved. The customer's app login is ready.",
    "time": 1791300717,
    "data": {
      "name": "Amina Hassan",
      "verification": {
        "mobile": true,
        "profile": true,
        "documents": "0/3",
        "consents": false,
        "complete": false
      },
      "app_login": {
        "status": "created",
        "user_id": 100,
        "message": "App login created. The customer logs in with their ID number."
      }
    }
  }
}

3.4a Upload ID front

POST/api/customers/upload_document

Verify and onboard

Live camera photo; a retake replaces the earlier one. Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
customer_id: 2109
doc_type: id_front
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/upload_document" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "customer_id=2109" \
  -F "doc_type=id_front" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "ID front saved.",
    "time": 1791300717,
    "data": {
      "id": 1,
      "doc_type": "id_front",
      "captured_at": "2026-10-06T18:31:57+03:00",
      "documents": "1/3",
      "missing": [
        "id_back",
        "selfie"
      ]
    }
  }
}

3.4b Upload ID back

POST/api/customers/upload_document

Verify and onboard

Live camera photo; a retake replaces the earlier one. Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
customer_id: 2109
doc_type: id_back
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/upload_document" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "customer_id=2109" \
  -F "doc_type=id_back" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "ID back saved.",
    "time": 1791300717,
    "data": {
      "id": 2,
      "doc_type": "id_back",
      "captured_at": "2026-10-06T18:31:57+03:00",
      "documents": "2/3",
      "missing": [
        "selfie"
      ]
    }
  }
}

3.4c Upload selfie

POST/api/customers/upload_document

Verify and onboard

Live camera photo; a retake replaces the earlier one. Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
customer_id: 2109
doc_type: selfie
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/upload_document" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "customer_id=2109" \
  -F "doc_type=selfie" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "Selfie saved.",
    "time": 1791300717,
    "data": {
      "id": 3,
      "doc_type": "selfie",
      "captured_at": "2026-10-06T18:31:57+03:00",
      "documents": "3/3",
      "missing": [],
      "verification": {
        "mobile": true,
        "profile": true,
        "documents": "3/3",
        "consents": false,
        "complete": false
      }
    }
  }
}

3.4d List customer documents

POST/api/customers/get_documents

Verify and onboard

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/get_documents" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300718,
    "data": {
      "documents": "3/3",
      "missing": [],
      "items": [
        {
          "id": 1,
          "doc_type": "id_front",
          "label": "ID front",
          "captured_at": "2026-10-06T18:31:57+03:00",
          "url": "https://vivo.websacco.com/customers/api_files/document/1/1791301318-c314e267d7b41c946ea6a9f0"
        },
        {
          "id": 2,
          "doc_type": "id_back",
          "label": "ID back",
          "captured_at": "2026-10-06T18:31:57+03:00",
          "url": "https://vivo.websacco.com/customers/api_files/document/2/1791301318-9a4b80bd02d581737341c057"
        },
        {
          "id": 3,
          "doc_type": "selfie",
          "label": "Selfie",
          "captured_at": "2026-10-06T18:31:57+03:00",
          "url": "https://vivo.websacco.com/customers/api_files/document/3/1791301318-041f1d4bb36bf28e538f22d5"
        }
      ]
    }
  }
}

3.5 Record consents and statement code

POST/api/customers/save_consents

Verify and onboard

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "notice_version": "v1",
    "consents": [
      "business_notice",
      "privacy_notice",
      "statement_authorisation"
    ],
    "statement_code": "978647"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/save_consents" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "notice_version": "v1",
    "consents": [
      "business_notice",
      "privacy_notice",
      "statement_authorisation"
    ],
    "statement_code": "978647"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Consents recorded. The customer can apply.",
    "time": 1791300718,
    "data": {
      "recorded": 3,
      "notice_version": "v1",
      "statement_code": "978647",
      "verification": {
        "mobile": true,
        "profile": true,
        "documents": "3/3",
        "consents": true,
        "complete": true
      },
      "can_apply": true
    }
  }
}

4.1 Submit application

POST/api/customers/submit_application

Apply and wait

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "statement_code": "978647",
    "idempotency_key": "8ff1cd2c-03ae-4010-b021-b69b1eb088c1"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/submit_application" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2109",
    "statement_code": "978647",
    "idempotency_key": "8ff1cd2c-03ae-4010-b021-b69b1eb088c1"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Application A-1057 submitted. A decision usually takes under 30 minutes.",
    "time": 1791300718,
    "data": {
      "id": 9,
      "application_no": "A-1057",
      "status": "submitted",
      "submitted_at": "2026-10-06T18:31:58+03:00",
      "decision_target_minutes": 30
    }
  }
}

4.2 Poll decision

POST/api/customers/get_application

Apply and wait

Repeat every 15 s until approved or declined.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "application_id": "9"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/customers/get_application" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "application_id": "9"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Waiting for review.",
    "time": 1791300718,
    "data": {
      "id": 9,
      "application_no": "A-1057",
      "name": "Lendora Finance",
      "status": "submitted",
      "limit": null,
      "valid_until": null,
      "decline_reason": null,
      "submitted_at": "2026-10-06T18:31:58+03:00",
      "decided_at": null
    }
  }
}

Devices API

Built

POST https://vivo.websacco.com/api/devices/<method>

What a salesperson can sell and for how much: the catalogue as a list of repayment plans, each with its devices and their price on that plan, stock at their store and, for a customer, only the devices whose cash (retail) price is within their approved limit. Also device details with stock at other stores, the active plans, a quote that matches exactly what orders/create_order will fix, store stock and IMEI checks. Read-only: prices and plans are set by head office. Answers carry fields in data.

Catalogue for a customer (limit check)

POST/api/devices/get_catalogue

data is the list of plans, each with its devices and their price on that plan; only devices whose cash price is within this customer's limit. meta has the customer, limit and store. Saves the first device to product_id.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2101"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_catalogue" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2101"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300719,
    "data": [
      {
        "plan_id": 1,
        "plan_name": "Standard 12 months",
        "code": "STD12",
        "default": true,
        "version_id": 1,
        "term_months": 12,
        "frequency": "daily",
        "payment_days": 360,
        "unsigned_order_expires_hours": 24,
        "device_count": 3,
        "devices": [
          {
            "product_id": 7,
            "name": "vivo Y04 4+64",
            "brand": "vivo",
            "model": "Y04",
            "ram_gb": 4,
            "storage_gb": 64,
            "sku": "VIVO-Y04-4-64",
            "colours": [
              "Green"
            ],
            "image_url": null,
            "in_stock": 6,
            "price_id": 19,
            "cash": 13000,
            "deposit": 2600,
            "deposit_min": 2600,
            "deposit_max": 3900,
            "deposit_ok": true,
            "daily": 45,
            "days": 360,
            "financed": 16200,
            "total": 18800,
            "within_limit": true
          },
          {
            "product_id": 6,
            "name": "vivo Y19s 4+128",
            "brand": "vivo",
            "model": "Y19s",
            "ram_gb": 4,
            "storage_gb": 128,
            "sku": "VIVO-Y19S-4-128",
            "colours": [
              "Black",
              "Silver"
            ],
            "image_url": null,
            "in_stock": 9,
            "price_id": 18,
            "cash": 18000,
            "deposit": 3600,
            "deposit_min": 3600,
            "deposit_max": 5400,
            "deposit_ok": true,
            "daily": 60,
            "days": 360,
            "financed": 21600,
            "total": 25200,
            "within_limit": true
          },
          {
            "product_id": 5,
            "name": "vivo Y28 8+256",
            "brand": "vivo",
            "model": "Y28",
            "ram_gb": 8,
            "storage_gb": 256,
            "sku": "VIVO-Y28-8-256",
            "colours": [
              "Emerald",
              "Black"
            ],
            "image_url": "https://vivo.websacco.com/uploads/devices/y28.png",
            "in_stock": 14,
            "price_id": 17,
            "cash": 30000,
            "deposit": 6000,
            "deposit_min": 6000,
            "deposit_max": 9000,
            "deposit_ok": true,
            "daily": 100,
            "days": 360,
            "financed": 36000,
            "total": 42000,
            "within_limit": true
          }
        ]
      },
      {
        "plan_id": 2,
        "plan_name": "Short 6 months",
        "code": "SHORT6",
        "default": false,
        "version_id": 2,
        "term_months": 6,
        "frequency": "daily",
        "payment_days": 180,
        "unsigned_order_expires_hours": 12,
        "device_count": 1,
        "devices": [
          {
            "product_id": 5,
            "name": "vivo Y28 8+256",
            "brand": "vivo",
            "model": "Y28",
            "ram_gb": 8,
            "storage_gb": 256,
            "sku": "VIVO-Y28-8-256",
            "colours": [
              "Emerald",
              "Black"
            ],
            "image_url": "https://vivo.websacco.com/uploads/devices/y28.png",
            "in_stock": 14,
            "price_id": 20,
            "cash": 30000,
            "deposit": 7500,
            "deposit_min": 7500,
            "deposit_max": 12000,
            "deposit_ok": true,
            "daily": 170,
            "days": 180,
            "financed": 30600,
            "total": 38100,
            "within_limit": true
          }
        ]
      }
    ],
    "meta": {
      "customer": {
        "id": 2101,
        "customer_no": "C-2101",
        "name": "Geoffrey Ongid",
        "application_no": "A-1049",
        "limit": 50000,
        "valid_until": "2026-12-01"
      },
      "limit": 50000,
      "store": {
        "id": 1,
        "code": "NBO-001",
        "name": "Nairobi CBD"
      },
      "plan_count": 2,
      "device_count": 4
    }
  }
}

Catalogue: search, in stock only

POST/api/devices/get_catalogue

Browse without a customer: filter by brand, model or SKU.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "search": "vivo",
    "in_stock_only": true
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_catalogue" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "search": "vivo",
    "in_stock_only": true
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300719,
    "data": [
      {
        "plan_id": 1,
        "plan_name": "Standard 12 months",
        "code": "STD12",
        "default": true,
        "version_id": 1,
        "term_months": 12,
        "frequency": "daily",
        "payment_days": 360,
        "unsigned_order_expires_hours": 24,
        "device_count": 3,
        "devices": [
          {
            "product_id": 7,
            "name": "vivo Y04 4+64",
            "brand": "vivo",
            "model": "Y04",
            "ram_gb": 4,
            "storage_gb": 64,
            "sku": "VIVO-Y04-4-64",
            "colours": [
              "Green"
            ],
            "image_url": null,
            "in_stock": 6,
            "price_id": 19,
            "cash": 13000,
            "deposit": 2600,
            "deposit_min": 2600,
            "deposit_max": 3900,
            "deposit_ok": true,
            "daily": 45,
            "days": 360,
            "financed": 16200,
            "total": 18800,
            "within_limit": null
          },
          {
            "product_id": 6,
            "name": "vivo Y19s 4+128",
            "brand": "vivo",
            "model": "Y19s",
            "ram_gb": 4,
            "storage_gb": 128,
            "sku": "VIVO-Y19S-4-128",
            "colours": [
              "Black",
              "Silver"
            ],
            "image_url": null,
            "in_stock": 9,
            "price_id": 18,
            "cash": 18000,
            "deposit": 3600,
            "deposit_min": 3600,
            "deposit_max": 5400,
            "deposit_ok": true,
            "daily": 60,
            "days": 360,
            "financed": 21600,
            "total": 25200,
            "within_limit": null
          },
          {
            "product_id": 5,
            "name": "vivo Y28 8+256",
            "brand": "vivo",
            "model": "Y28",
            "ram_gb": 8,
            "storage_gb": 256,
            "sku": "VIVO-Y28-8-256",
            "colours": [
              "Emerald",
              "Black"
            ],
            "image_url": "https://vivo.websacco.com/uploads/devices/y28.png",
            "in_stock": 14,
            "price_id": 17,
            "cash": 30000,
            "deposit": 6000,
            "deposit_min": 6000,
            "deposit_max": 9000,
            "deposit_ok": true,
            "daily": 100,
            "days": 360,
            "financed": 36000,
            "total": 42000,
            "within_limit": null
          }
        ]
      },
      {
        "plan_id": 2,
        "plan_name": "Short 6 months",
        "code": "SHORT6",
        "default": false,
        "version_id": 2,
        "term_months": 6,
        "frequency": "daily",
        "payment_days": 180,
        "unsigned_order_expires_hours": 12,
        "device_count": 1,
        "devices": [
          {
            "product_id": 5,
            "name": "vivo Y28 8+256",
            "brand": "vivo",
            "model": "Y28",
            "ram_gb": 8,
            "storage_gb": 256,
            "sku": "VIVO-Y28-8-256",
            "colours": [
              "Emerald",
              "Black"
            ],
            "image_url": "https://vivo.websacco.com/uploads/devices/y28.png",
            "in_stock": 14,
            "price_id": 20,
            "cash": 30000,
            "deposit": 7500,
            "deposit_min": 7500,
            "deposit_max": 12000,
            "deposit_ok": true,
            "daily": 170,
            "days": 180,
            "financed": 30600,
            "total": 38100,
            "within_limit": null
          }
        ]
      }
    ],
    "meta": {
      "customer": null,
      "limit": null,
      "store": {
        "id": 1,
        "code": "NBO-001",
        "name": "Nairobi CBD"
      },
      "plan_count": 2,
      "device_count": 4
    }
  }
}

Device details

POST/api/devices/get_device

Every plan's price, deposit range, stock here and at other stores.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "product_id": "7",
    "customer_id": "2101"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_device" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "product_id": "7",
    "customer_id": "2101"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300719,
    "data": {
      "product_id": 7,
      "name": "vivo Y04 4+64",
      "brand": "vivo",
      "model": "Y04",
      "ram_gb": 4,
      "storage_gb": 64,
      "sku": "VIVO-Y04-4-64",
      "colours": [
        "Green"
      ],
      "image_url": null,
      "for_sale": true,
      "limit": 50000,
      "prices": [
        {
          "plan_id": 1,
          "plan": "Standard 12 months",
          "price_id": 19,
          "cash": 13000,
          "deposit": 2600,
          "deposit_min": 2600,
          "deposit_max": 3900,
          "deposit_ok": true,
          "daily": 45,
          "days": 360,
          "financed": 16200,
          "total": 18800,
          "within_limit": true
        }
      ],
      "stock": {
        "on_hand": 6,
        "reserved": 0,
        "available": 6
      },
      "available_elsewhere": []
    }
  }
}

Repayment plans

POST/api/devices/get_plans

Active plans and their current rules.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_plans" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300719,
    "data": {
      "plans": [
        {
          "id": 1,
          "code": "STD12",
          "name": "Standard 12 months",
          "default": true,
          "version_id": 1,
          "term_months": 12,
          "frequency": "daily",
          "payment_days": 360,
          "unsigned_order_expires_hours": 24
        },
        {
          "id": 2,
          "code": "SHORT6",
          "name": "Short 6 months",
          "default": false,
          "version_id": 2,
          "term_months": 6,
          "frequency": "daily",
          "payment_days": 180,
          "unsigned_order_expires_hours": 12
        }
      ]
    }
  }
}

Quote

POST/api/devices/get_quote

The quote create_order will fix. Nothing is reserved.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "product_id": "7",
    "plan_id": 1,
    "deposit_amount": 6000,
    "customer_id": "2101"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_quote" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "product_id": "7",
    "plan_id": 1,
    "deposit_amount": 6000,
    "customer_id": "2101"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Deposit must be between KES 2,600 and KES 3,900.",
    "time": 1791300719,
    "data": {
      "device": {
        "product_id": 7,
        "name": "vivo Y04 4+64",
        "brand": "vivo",
        "model": "Y04",
        "ram_gb": 4,
        "storage_gb": 64,
        "sku": "VIVO-Y04-4-64",
        "colours": [
          "Green"
        ],
        "image_url": null
      },
      "customer": {
        "id": 2101,
        "limit": 50000
      },
      "quote": {
        "plan_id": 1,
        "plan": "Standard 12 months",
        "price_id": 19,
        "cash": 13000,
        "deposit": 6000,
        "deposit_min": 2600,
        "deposit_max": 3900,
        "deposit_ok": false,
        "daily": 45,
        "days": 360,
        "financed": 16200,
        "total": 22200,
        "within_limit": true,
        "in_stock": 6
      },
      "can_order": false
    }
  }
}

Stock at my store

POST/api/devices/get_store_stock

On hand, reserved and available per device.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/get_store_stock" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300719,
    "data": {
      "store": {
        "id": 1,
        "code": "NBO-001",
        "name": "Nairobi CBD"
      },
      "totals": {
        "on_hand": 29,
        "reserved": 0,
        "available": 29
      },
      "items": [
        {
          "product_id": 9,
          "name": "vivo X200 Pro 12+512",
          "sku": "VIVO-X200",
          "on_hand": 0,
          "reserved": 0,
          "available": 0
        },
        {
          "product_id": 7,
          "name": "vivo Y04 4+64",
          "sku": "VIVO-Y04-4-64",
          "on_hand": 6,
          "reserved": 0,
          "available": 6
        },
        {
          "product_id": 6,
          "name": "vivo Y19s 4+128",
          "sku": "VIVO-Y19S-4-128",
          "on_hand": 9,
          "reserved": 0,
          "available": 9
        },
        {
          "product_id": 5,
          "name": "vivo Y28 8+256",
          "sku": "VIVO-Y28-8-256",
          "on_hand": 14,
          "reserved": 0,
          "available": 14
        }
      ]
    }
  }
}

Check an IMEI

POST/api/devices/check_imei

Valid, known, in stock, or already on a plan?

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "imei": "354129071842263"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/devices/check_imei" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "imei": "354129071842263"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Not registered yet. It is registered when the IMEI is confirmed on an order.",
    "time": 1791300719,
    "data": {
      "imei": "354129071842263",
      "known": false,
      "can_sell": true,
      "open_order": null
    }
  }
}

Orders API

Built

POST https://vivo.websacco.com/api/orders/<method>

Order to handover: create the order (price fixed), photograph the IMEI label (read by Claude), confirm the IMEI, M-Pesa deposit from the customer's own number, agreement signed by SMS code, enrol the device with VTrust (entering the code from the phone when VTrust asks for it), four live handover photos, record the handover. Answers carry fields in data.

5.2 Create order

POST/api/orders/create_order

5. Device and IMEI

Reserves stock and fixes the price. Saves order_id.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2101",
    "product_id": "5",
    "plan_id": 1,
    "colour": "Emerald",
    "idempotency_key": "ea8d7093-e9f9-4c37-9017-2cdd717e6b32"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/create_order" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2101",
    "product_id": "5",
    "plan_id": 1,
    "colour": "Emerald",
    "idempotency_key": "ea8d7093-e9f9-4c37-9017-2cdd717e6b32"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Order ORD-1001 created. Photograph the IMEI label next.",
    "time": 1791300720,
    "data": {
      "id": "ORD-1001",
      "order_id": 1,
      "status": "draft",
      "status_label": "Draft",
      "customer": {
        "id": 2101,
        "name": "Geoffrey Ongid",
        "phone_masked": "254748***489"
      },
      "device": {
        "product_id": 5,
        "name": "vivo Y28 8+256",
        "colour": "Emerald"
      },
      "plan": {
        "id": 1,
        "name": "Standard 12 months",
        "version_id": 1,
        "price_id": 17
      },
      "quote": {
        "cash": 30000,
        "deposit": 6000,
        "daily": 100,
        "days": 360,
        "total": 42000
      },
      "imei": {
        "imei": null,
        "imei_2": null,
        "source": null,
        "last_ocr": null
      },
      "deposit": null,
      "agreement": null,
      "activation": null,
      "handover": {
        "photos": "0/4",
        "missing": [
          "provider_home",
          "app_home",
          "salesperson_with_customer",
          "customer_with_id"
        ],
        "ready_for_handover": false,
        "plan_no": null
      },
      "photos": {
        "imei_label": null,
        "handover": []
      },
      "expires_at": "2026-10-07T18:32:00+03:00",
      "created_at": "2026-10-06T18:32:00+03:00",
      "next": "imei"
    }
  }
}

5.3 Upload IMEI label photo (Claude OCR)

POST/api/orders/upload_imei_photo

5. Device and IMEI

Sends the label photo to Claude. Saves imei from ocr.imei. Choose the label photo in Body → form-data → file. Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
order_id: ORD-1001
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/upload_imei_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "order_id=ORD-1001" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "IMEI read from the label. Check it matches the device and confirm.",
    "time": 1791300720,
    "data": {
      "photo_id": 1,
      "photo": {
        "id": 1,
        "type": "imei_label",
        "kind": "imei_label",
        "label": "IMEI label",
        "is_current": true,
        "captured_at": "2026-10-06T18:32:00+03:00",
        "url": "https://vivo.websacco.com/orders/api_files/imei/1/1791301320-6228a59f503d1e3a82183a02",
        "url_expires_in": 600,
        "portal_url": "https://vivo.websacco.com/group/orders/photo/imei/1",
        "stored": true,
        "mime_type": "image/jpeg",
        "file_size": 43955,
        "width": 800,
        "height": 600,
        "sha256": "d541113dd0a8f18d042b52ca9216a8493cda474e23a3a9452bd8de639689cb71",
        "ocr": {
          "status": "read",
          "imei": "354129071842263",
          "confidence": 0.98
        }
      },
      "ocr": {
        "status": "read",
        "imei": "354129071842263",
        "imei_2": "354129071842271",
        "confidence": 0.98,
        "check_digit_valid": true,
        "barcode_matches": true,
        "model_matches": true,
        "on_active_plan": false,
        "reason": null,
        "notes": null
      },
      "label": {
        "label_type": "retail_box",
        "brand": "vivo",
        "model": "Y28",
        "ram_gb": 8,
        "storage_gb": 256,
        "colour": "Emerald",
        "serial_number": "V2316A8K2"
      }
    }
  }
}

5.4 Confirm IMEI

POST/api/orders/confirm_imei

5. Device and IMEI

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "imei": "354129071842263",
    "photo_id": "1"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/confirm_imei" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "imei": "354129071842263",
    "photo_id": "1"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "IMEI confirmed. Send the deposit request next.",
    "time": 1791300720,
    "data": {
      "imei": "354129071842263",
      "status": "imei_confirmed",
      "source": "ocr",
      "checks": {
        "check_digit": true,
        "not_on_active_plan": true,
        "label_photo_live": true,
        "matches_ocr": true
      }
    }
  }
}

6.1 Send deposit STK push

POST/api/orders/request_deposit

6. Deposit

Saves checkout_request_id for the sandbox callback.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "payer_phone": "254748974489",
    "idempotency_key": "7b5edcde-a545-473f-b48d-4257a3061f43"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/request_deposit" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "payer_phone": "254748974489",
    "idempotency_key": "7b5edcde-a545-473f-b48d-4257a3061f43"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Payment prompt sent. Ask the customer to enter their M-Pesa PIN.",
    "time": 1791300720,
    "data": {
      "deposit_id": 1,
      "amount": 6000,
      "status": "pending",
      "checkout_request_id": "ws_CO_061020261832000829",
      "poll_every_seconds": 5,
      "timeout_seconds": 120
    }
  }
}

6.3 M-Pesa STK result

Callback · server to server
POST/orders/callbacks/stk_callback

6. Deposit

Plays Safaricom's part in sandbox. Disable outside sandbox. Amount and PhoneNumber must match the order's deposit and the customer's number, or the payment is held.

Sample request (sent by M-Pesa)
{
  "Body": {
    "stkCallback": {
      "MerchantRequestID": "29115-34620561-1",
      "CheckoutRequestID": "{{checkout_request_id}}",
      "ResultCode": 0,
      "ResultDesc": "The service request is processed successfully.",
      "CallbackMetadata": {
        "Item": [
          {
            "Name": "Amount",
            "Value": 6000
          },
          {
            "Name": "MpesaReceiptNumber",
            "Value": "S000TMAER7"
          },
          {
            "Name": "TransactionDate",
            "Value": 20261004090012
          },
          {
            "Name": "PhoneNumber",
            "Value": 254748974489
          }
        ]
      }
    }
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/orders/callbacks/stk_callback" \
  -H "Content-Type: application/json" \
  -d '{
  "Body": {
    "stkCallback": {
      "MerchantRequestID": "29115-34620561-1",
      "CheckoutRequestID": "{{checkout_request_id}}",
      "ResultCode": 0,
      "ResultDesc": "The service request is processed successfully.",
      "CallbackMetadata": {
        "Item": [
          {
            "Name": "Amount",
            "Value": 6000
          },
          {
            "Name": "MpesaReceiptNumber",
            "Value": "S000TMAER7"
          },
          {
            "Name": "TransactionDate",
            "Value": 20261004090012
          },
          {
            "Name": "PhoneNumber",
            "Value": 254748974489
          }
        ]
      }
    }
  }
}'
Sample response
{
  "ResultCode": 0,
  "ResultDesc": "Accepted"
}

6.2 Deposit status

POST/api/orders/deposit_status

6. Deposit

Poll every 5 s until status is paid.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/deposit_status" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Deposit received.",
    "time": 1791300720,
    "data": {
      "status": "paid",
      "amount": 6000,
      "mpesa_receipt": "S000TMAER7",
      "paid_at": "2026-10-06T18:32:00+03:00",
      "result_desc": "The service request is processed successfully."
    }
  }
}

7.1 Generate agreement

POST/api/orders/generate_agreement

7. Agreement

Open agreement_url in a browser within 10 minutes to see the agreement.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/generate_agreement" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Let the customer read the agreement, then send the signing code.",
    "time": 1791300720,
    "data": {
      "agreement_no": "HP-1001",
      "template": "HP-TEMPLATE v1.0",
      "document_url": "https://vivo.websacco.com/orders/api_files/agreement/HP-1001/1791301320-e81a8e155143f26c130d8a1d",
      "cash_price": 30000,
      "hire_purchase_price": 42000,
      "deposit": 6000,
      "instalment": {
        "amount": 100,
        "count": 360,
        "every": "day"
      },
      "must_confirm_read": true
    }
  }
}

7.2 Send signing code

POST/api/orders/send_sign_code

7. Agreement

Saves sign_otp_ref. In sandbox with return_debug_otp on, also saves the code to sign_code; otherwise type the SMS code into sign_code.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/send_sign_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Signing code sent to the customer.",
    "time": 1791300720,
    "data": {
      "otp_ref": "otp_d730e698",
      "sent_to": "254748***489",
      "expires_in": 300,
      "debug_code": "123456"
    }
  }
}

7.3 Customer signs

POST/api/orders/sign_agreement

7. Agreement

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "otp_ref": "otp_d730e698",
    "code": "123456",
    "read_confirmed": true
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/sign_agreement" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "otp_ref": "otp_d730e698",
    "code": "123456",
    "read_confirmed": true
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Agreement signed. Enrol the device next.",
    "time": 1791300720,
    "data": {
      "agreement_no": "HP-1001",
      "status": "executed",
      "customer_signed_at": "2026-10-06T18:32:00+03:00",
      "signatory": "signed",
      "copy": {
        "delivered": true,
        "channel": "sms_link"
      }
    }
  }
}

8.1 Enrol device

POST/api/orders/start_activation

8. Activate and hand over

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/start_activation" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Enter the activation code on the device, then wait for Active.",
    "time": 1791300720,
    "data": {
      "provider": "vtrust",
      "provider_state": "Inactivated",
      "activation_code": "9362-952D",
      "poll_every_seconds": 5
    }
  }
}

With VTrust (locking_mode = vtrust, design): no activation_code; the answer carries provider_status, lock_time and next. Errors: AGREEMENT_NOT_EXECUTED, DEVICE_NOT_IN_SCOPE, DEVICE_NOT_RECOGNISED, AUTHORISATION_LIMIT, LOCKING_UNAVAILABLE. A second call returns the current state.

Response with VTrust: imported phone (status 8)
{
  "response": {
    "status": 1,
    "message": "Enrolled. Keep the phone on and online.",
    "time": 1791300720,
    "data": {
      "provider": "vtrust",
      "provider_state": "Inactivated",
      "provider_status": 8,
      "lock_time": "2026-10-17T23:59:00+03:00",
      "next": "wait_online",
      "poll_every_seconds": 5
    }
  }
}
Response with VTrust: phone needs the code (status 9)
{
  "response": {
    "status": 1,
    "message": "Enter the code the phone is showing.",
    "time": 1791300720,
    "data": {
      "provider": "vtrust",
      "provider_state": "Unauthorized",
      "provider_status": 9,
      "lock_time": "2026-10-17T23:59:00+03:00",
      "next": "enter_auth_code",
      "code_length": 6,
      "resend_after_seconds": 60,
      "poll_every_seconds": 5
    }
  }
}

8.2 Activation status

POST/api/orders/activation_status

8. Activate and hand over

Repeat every 5 s until provider_state is Active (mock mode: after locking_mock_activate_seconds).

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/activation_status" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Waiting for the device to report Active.",
    "time": 1791300720,
    "data": {
      "provider_state": "Inactivated",
      "activated_at": null,
      "ready_for_handover": false
    }
  }
}

With VTrust (design): answered from the order, which the status push keeps current; our API asks VTrust device/info only if no push has arrived for 10 s. Stop polling when next is handover_photos or call_head_office; after 3 minutes the answer is ACTIVATION_TIMEOUT and Check again resumes.

Response with VTrust: Active
{
  "response": {
    "status": 1,
    "message": "The phone is Active. Take the four handover photos.",
    "time": 1791300720,
    "data": {
      "provider_state": "Active",
      "provider_status": 1,
      "activated_at": "2026-10-16T15:57:12+03:00",
      "lock_time": "2026-10-17T23:59:00+03:00",
      "ready_for_handover": true,
      "next": "handover_photos"
    }
  }
}
Response with VTrust: still offline after 3 minutes
{
  "response": {
    "status": 0,
    "message": "The phone hasn't connected yet. Check it's online and the date and time are right.",
    "time": 1791300720,
    "error_code": "ACTIVATION_TIMEOUT",
    "http_status": 409,
    "data": {
      "provider_state": "Inactivated",
      "provider_status": 8,
      "next": "wait_online"
    }
  }
}

8.2a Enter the code from the phone

Design · to build
POST/api/orders/verify_activation_code

8. Activate and hand over

Only when next is enter_auth_code (VTrust status 9). Sends auth_code (the six digits on the handset) to VTrust device/verify-auth-code; the code is never stored. On success the phone moves to status 8 and the app goes back to polling activation_status. Errors: AUTH_CODE_WRONG (401), AUTH_CODE_LOCKED (429), AUTH_CODE_NOT_NEEDED (409), ACTIVATION_NOT_STARTED (409), LOCKING_UNAVAILABLE (502).

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "auth_code": "180165"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/verify_activation_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "auth_code": "180165"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Code accepted. Keep the phone on and online.",
    "time": 1791300720,
    "data": {
      "provider_state": "Inactivated",
      "provider_status": 8,
      "next": "wait_online",
      "poll_every_seconds": 5
    }
  }
}
Sample refusal: wrong code
{
  "response": {
    "status": 0,
    "message": "That code doesn't match the phone. Check and try again.",
    "time": 1791300720,
    "error_code": "AUTH_CODE_WRONG",
    "http_status": 401,
    "data": {
      "provider_state": "Unauthorized",
      "provider_status": 9,
      "next": "enter_auth_code"
    }
  }
}

8.2b Send a new code

Design · to build
POST/api/orders/resend_activation_code

8. Activate and hand over

Asks VTrust (device/send-auth-code) to show a new code on the handset; the old code stops working. At most once every 60 seconds per order: a sooner call gets TOO_SOON with retry_after_seconds.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/resend_activation_code" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "A new code is on the phone.",
    "time": 1791300720,
    "data": {
      "provider_state": "Unauthorized",
      "provider_status": 9,
      "next": "enter_auth_code",
      "resend_after_seconds": 60
    }
  }
}
Sample refusal: too soon
{
  "response": {
    "status": 0,
    "message": "You can ask for a new code in 42 seconds.",
    "time": 1791300720,
    "error_code": "TOO_SOON",
    "http_status": 409,
    "data": {
      "retry_after_seconds": 42
    }
  }
}

8.6 locking-layer event

Callback · server to server
POST/orders/callbacks/locking_event

8. Activate and hand over

Signed with locking_webhook_secret by the pre-request script.

Sample request (sent by the locking layer)
{
  "event": "state_changed",
  "imei": "{{imei}}",
  "state": "Active",
  "at": "2026-10-04T09:00:05+03:00"
}
Sample curl
curl -X POST "https://vivo.websacco.com/orders/callbacks/locking_event" \
  -H "Content-Type: application/json" \
  -d '{
  "event": "state_changed",
  "imei": "{{imei}}",
  "state": "Active",
  "at": "2026-10-04T09:00:05+03:00"
}'
Sample response
{
  "received": true
}

8.7 VTrust status push

Callback · server to serverDesign · to build
POST/orders/callbacks/vtrust

8. Activate and hand over · after handover

VTrust calls this when a device changes state (deviceStatusChange), when a SIM is bound (deviceBinding) and when a batch task finishes (batchTaskResult). Registered with VTrust as the webhook URL. The device is found by deviceId (IMEI1). Replaces 8.6 locking-layer event when locking_mode is vtrust.

HeaderMeaning
-x-vtrust-transactionIdUnique ID of the push (UUID, no dashes). Used to drop repeats: VTrust retries up to 3 times (about 5 s, then 10 s) until it gets HTTP 2xx.
-x-vtrust-timestampPush time, epoch milliseconds. Older than 5 minutes is refused.
-x-vtrust-signatureHmacSHA256_hex(rawBody + transactionId + timestamp, secretKey), lowercase hex; compared in constant time. Not the same as the request signature our server sends to VTrust.
operationTypeMeaningWhat we do
3ActivatedOrder → ready_for_handover, activated_at saved, welcome message
5Locked (confirmed)Plan and unit marked locked
7Unlocked (confirmed)Plan and unit marked active
9ReleasedPermanent unlock recorded
13Relock timestamp setLock date confirmed
21 / 23Progressive lock / unlock confirmedPlan state updated
18 (deviceBinding)SIM card boundLogged only
Sample request (sent by VTrust)
{
  "eventType": "deviceStatusChange",
  "operationType": 3,
  "operationDesc": "Activated",
  "deviceId": "{{imei}}",
  "oldStatus": "UNACTIVATED",
  "newStatus": "ACTIVE",
  "timestamp": 1791300725000
}
Sample response (HTTP 200)
{
  "received": true
}
Bad signature (HTTP 401)
{
  "received": false,
  "error_code": "SIGNATURE_INVALID"
}

8.5x Handover too early is refused

Refusal example
POST/api/orders/record_handover

8. Activate and hand over

Expected: EVIDENCE_MISSING or CHECKLIST_INCOMPLETE.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "education_checklist": [
      "locking_policy"
    ]
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/record_handover" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "education_checklist": [
      "locking_policy"
    ]
  }
}'
Sample response
{
  "response": {
    "status": 0,
    "message": "Take all four handover photos first.",
    "time": 1791300720,
    "error_code": "EVIDENCE_MISSING",
    "http_status": 422,
    "data": {
      "missing": [
        "provider_home",
        "app_home",
        "salesperson_with_customer",
        "customer_with_id"
      ]
    }
  }
}

8.3a Photo: provider home

POST/api/orders/upload_handover_photo

8. Activate and hand over

Sent as multipart/form-data; the photo goes in the "file" field.

Change with VTrust: handover photos are refused with ACTIVATION_PENDING until the order is ready_for_handover; capture_source must be camera. kind: provider_home | app_home | salesperson_with_customer | customer_with_id.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
order_id: ORD-1001
kind: provider_home
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/upload_handover_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "order_id=ORD-1001" \
  -F "kind=provider_home" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "Locking provider home screen saved.",
    "time": 1791300720,
    "data": {
      "id": 1,
      "kind": "provider_home",
      "photo": {
        "id": 1,
        "type": "handover",
        "kind": "provider_home",
        "label": "Locking provider home screen",
        "is_current": true,
        "captured_at": "2026-10-06T18:32:00+03:00",
        "url": "https://vivo.websacco.com/orders/api_files/handover/1/1791301320-318eb407eb4b7ab1a2084bd8",
        "url_expires_in": 600,
        "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/1",
        "stored": true,
        "mime_type": "image/jpeg",
        "file_size": 18862,
        "width": 600,
        "height": 800,
        "sha256": "ab23d117e0553f8d6fc7afc08b95dd5b14c3d6a04589a1fed244cbbd6cd3992b"
      },
      "photos": "1/4",
      "missing": [
        "app_home",
        "salesperson_with_customer",
        "customer_with_id"
      ],
      "ready_for_handover": false
    }
  }
}

8.3b Photo: app home

POST/api/orders/upload_handover_photo

8. Activate and hand over

Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
order_id: ORD-1001
kind: app_home
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/upload_handover_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "order_id=ORD-1001" \
  -F "kind=app_home" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "Customer app home screen saved.",
    "time": 1791300720,
    "data": {
      "id": 2,
      "kind": "app_home",
      "photo": {
        "id": 2,
        "type": "handover",
        "kind": "app_home",
        "label": "Customer app home screen",
        "is_current": true,
        "captured_at": "2026-10-06T18:32:00+03:00",
        "url": "https://vivo.websacco.com/orders/api_files/handover/2/1791301320-6b942c3440d4bebbcde31523",
        "url_expires_in": 600,
        "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/2",
        "stored": true,
        "mime_type": "image/jpeg",
        "file_size": 17828,
        "width": 600,
        "height": 800,
        "sha256": "21d0150b504ad63764cb57c4373eedc7b92d34d5d34727318119a242ea2dde3b"
      },
      "photos": "2/4",
      "missing": [
        "salesperson_with_customer",
        "customer_with_id"
      ],
      "ready_for_handover": false
    }
  }
}

8.3c Photo: salesperson with customer

POST/api/orders/upload_handover_photo

8. Activate and hand over

Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
order_id: ORD-1001
kind: salesperson_with_customer
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/upload_handover_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "order_id=ORD-1001" \
  -F "kind=salesperson_with_customer" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "Salesperson with customer saved.",
    "time": 1791300721,
    "data": {
      "id": 3,
      "kind": "salesperson_with_customer",
      "photo": {
        "id": 3,
        "type": "handover",
        "kind": "salesperson_with_customer",
        "label": "Salesperson with customer",
        "is_current": true,
        "captured_at": "2026-10-06T18:32:00+03:00",
        "url": "https://vivo.websacco.com/orders/api_files/handover/3/1791301321-c1126eb91c7260173ab7bed4",
        "url_expires_in": 600,
        "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/3",
        "stored": true,
        "mime_type": "image/jpeg",
        "file_size": 19533,
        "width": 600,
        "height": 800,
        "sha256": "4f0c5b971af50ddbd10405d1f87dd752fbe29ff602462d168f32357bf6fedd18"
      },
      "photos": "3/4",
      "missing": [
        "customer_with_id"
      ],
      "ready_for_handover": false
    }
  }
}

8.3d Photo: customer with id

POST/api/orders/upload_handover_photo

8. Activate and hand over

Sent as multipart/form-data; the photo goes in the "file" field.

Sample request (form-data)
Content-Type: multipart/form-data

request_id: 1201
api_key: YOUR_API_KEY
user_id: 7
order_id: ORD-1001
kind: customer_with_id
capture_source: camera
file: (the photo file, JPEG or PNG, max 5 MB)
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/upload_handover_photo" \
  -F "request_id=1201" \
  -F "api_key=YOUR_API_KEY" \
  -F "user_id=7" \
  -F "order_id=ORD-1001" \
  -F "kind=customer_with_id" \
  -F "capture_source=camera" \
  -F "file=@photo.jpg;type=image/jpeg"
Sample response
{
  "response": {
    "status": 1,
    "message": "Customer holding national ID saved.",
    "time": 1791300721,
    "data": {
      "id": 4,
      "kind": "customer_with_id",
      "photo": {
        "id": 4,
        "type": "handover",
        "kind": "customer_with_id",
        "label": "Customer holding national ID",
        "is_current": true,
        "captured_at": "2026-10-06T18:32:01+03:00",
        "url": "https://vivo.websacco.com/orders/api_files/handover/4/1791301321-7332bd39f67b62d50afd69c0",
        "url_expires_in": 600,
        "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/4",
        "stored": true,
        "mime_type": "image/jpeg",
        "file_size": 18010,
        "width": 600,
        "height": 800,
        "sha256": "18125a225c86aa808ba59ab04dfc52aae56d8d64f2140de2faf98a4e61a25890"
      },
      "photos": "4/4",
      "missing": [],
      "ready_for_handover": true
    }
  }
}

8.4 List handover photos

POST/api/orders/handover_photos

8. Activate and hand over

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/handover_photos" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300721,
    "data": {
      "photos": "4/4",
      "missing": [],
      "ready_for_handover": true,
      "items": [
        {
          "id": 1,
          "type": "handover",
          "kind": "provider_home",
          "label": "Locking provider home screen",
          "is_current": true,
          "captured_at": "2026-10-06T18:32:00+03:00",
          "url": "https://vivo.websacco.com/orders/api_files/handover/1/1791301321-d9e1a5c54a071a4a3642103b",
          "url_expires_in": 600,
          "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/1",
          "stored": true,
          "mime_type": "image/jpeg",
          "file_size": 18862,
          "width": 600,
          "height": 800,
          "sha256": "ab23d117e0553f8d6fc7afc08b95dd5b14c3d6a04589a1fed244cbbd6cd3992b"
        },
        {
          "id": 2,
          "type": "handover",
          "kind": "app_home",
          "label": "Customer app home screen",
          "is_current": true,
          "captured_at": "2026-10-06T18:32:00+03:00",
          "url": "https://vivo.websacco.com/orders/api_files/handover/2/1791301321-7a52819d0d1654fb24f09d8d",
          "url_expires_in": 600,
          "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/2",
          "stored": true,
          "mime_type": "image/jpeg",
          "file_size": 17828,
          "width": 600,
          "height": 800,
          "sha256": "21d0150b504ad63764cb57c4373eedc7b92d34d5d34727318119a242ea2dde3b"
        },
        {
          "id": 3,
          "type": "handover",
          "kind": "salesperson_with_customer",
          "label": "Salesperson with customer",
          "is_current": true,
          "captured_at": "2026-10-06T18:32:00+03:00",
          "url": "https://vivo.websacco.com/orders/api_files/handover/3/1791301321-c1126eb91c7260173ab7bed4",
          "url_expires_in": 600,
          "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/3",
          "stored": true,
          "mime_type": "image/jpeg",
          "file_size": 19533,
          "width": 600,
          "height": 800,
          "sha256": "4f0c5b971af50ddbd10405d1f87dd752fbe29ff602462d168f32357bf6fedd18"
        },
        {
          "id": 4,
          "type": "handover",
          "kind": "customer_with_id",
          "label": "Customer holding national ID",
          "is_current": true,
          "captured_at": "2026-10-06T18:32:01+03:00",
          "url": "https://vivo.websacco.com/orders/api_files/handover/4/1791301321-7332bd39f67b62d50afd69c0",
          "url_expires_in": 600,
          "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/4",
          "stored": true,
          "mime_type": "image/jpeg",
          "file_size": 18010,
          "width": 600,
          "height": 800,
          "sha256": "18125a225c86aa808ba59ab04dfc52aae56d8d64f2140de2faf98a4e61a25890"
        }
      ]
    }
  }
}

8.5 Record handover

POST/api/orders/record_handover

8. Activate and hand over

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "education_checklist": [
      "locking_policy",
      "how_to_pay",
      "permanent_unlock",
      "no_factory_reset",
      "report_loss"
    ],
    "idempotency_key": "cde32d5b-e38d-4879-ac3e-5987ba3a1c4b"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/record_handover" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001",
    "education_checklist": [
      "locking_policy",
      "how_to_pay",
      "permanent_unlock",
      "no_factory_reset",
      "report_loss"
    ],
    "idempotency_key": "cde32d5b-e38d-4879-ac3e-5987ba3a1c4b"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Handover recorded. The plan is active.",
    "time": 1791300721,
    "data": {
      "plan_no": "HP-1001",
      "plan_status": "active",
      "device_state": "Active",
      "days_of_use": 1
    }
  }
}

Get order

POST/api/orders/get_order

Lookups and cancel

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/get_order" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1001"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300721,
    "data": {
      "id": "ORD-1001",
      "order_id": 1,
      "status": "handed_over",
      "status_label": "Handed over",
      "customer": {
        "id": 2101,
        "name": "Geoffrey Ongid",
        "phone_masked": "254748***489"
      },
      "device": {
        "product_id": 5,
        "name": "vivo Y28 8+256",
        "colour": "Emerald"
      },
      "plan": {
        "id": 1,
        "name": "Standard 12 months",
        "version_id": 1,
        "price_id": 17
      },
      "quote": {
        "cash": 30000,
        "deposit": 6000,
        "daily": 100,
        "days": 360,
        "total": 42000
      },
      "imei": {
        "imei": "354129071842263",
        "imei_2": "354129071842271",
        "source": "ocr",
        "last_ocr": {
          "photo_id": 1,
          "status": "read",
          "imei": "354129071842263"
        }
      },
      "deposit": {
        "status": "paid",
        "amount": 6000,
        "mpesa_receipt": "S000TMAER7"
      },
      "agreement": {
        "agreement_no": "HP-1001",
        "status": "executed"
      },
      "activation": {
        "provider": "vtrust",
        "state": "Active"
      },
      "handover": {
        "photos": "4/4",
        "missing": [],
        "ready_for_handover": true,
        "plan_no": "HP-1001"
      },
      "photos": {
        "imei_label": {
          "id": 1,
          "type": "imei_label",
          "kind": "imei_label",
          "label": "IMEI label",
          "is_current": true,
          "captured_at": "2026-10-06T18:32:00+03:00",
          "url": "https://vivo.websacco.com/orders/api_files/imei/1/1791301321-6202c111ee6bdc6fbd60e569",
          "url_expires_in": 600,
          "portal_url": "https://vivo.websacco.com/group/orders/photo/imei/1",
          "stored": true,
          "mime_type": "image/jpeg",
          "file_size": 43955,
          "width": 800,
          "height": 600,
          "sha256": "d541113dd0a8f18d042b52ca9216a8493cda474e23a3a9452bd8de639689cb71",
          "ocr": {
            "status": "read",
            "imei": "354129071842263",
            "confidence": 0.98
          }
        },
        "handover": [
          {
            "id": 1,
            "type": "handover",
            "kind": "provider_home",
            "label": "Locking provider home screen",
            "is_current": true,
            "captured_at": "2026-10-06T18:32:00+03:00",
            "url": "https://vivo.websacco.com/orders/api_files/handover/1/1791301321-d9e1a5c54a071a4a3642103b",
            "url_expires_in": 600,
            "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/1",
            "stored": true,
            "mime_type": "image/jpeg",
            "file_size": 18862,
            "width": 600,
            "height": 800,
            "sha256": "ab23d117e0553f8d6fc7afc08b95dd5b14c3d6a04589a1fed244cbbd6cd3992b"
          },
          {
            "id": 2,
            "type": "handover",
            "kind": "app_home",
            "label": "Customer app home screen",
            "is_current": true,
            "captured_at": "2026-10-06T18:32:00+03:00",
            "url": "https://vivo.websacco.com/orders/api_files/handover/2/1791301321-7a52819d0d1654fb24f09d8d",
            "url_expires_in": 600,
            "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/2",
            "stored": true,
            "mime_type": "image/jpeg",
            "file_size": 17828,
            "width": 600,
            "height": 800,
            "sha256": "21d0150b504ad63764cb57c4373eedc7b92d34d5d34727318119a242ea2dde3b"
          },
          {
            "id": 3,
            "type": "handover",
            "kind": "salesperson_with_customer",
            "label": "Salesperson with customer",
            "is_current": true,
            "captured_at": "2026-10-06T18:32:00+03:00",
            "url": "https://vivo.websacco.com/orders/api_files/handover/3/1791301321-c1126eb91c7260173ab7bed4",
            "url_expires_in": 600,
            "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/3",
            "stored": true,
            "mime_type": "image/jpeg",
            "file_size": 19533,
            "width": 600,
            "height": 800,
            "sha256": "4f0c5b971af50ddbd10405d1f87dd752fbe29ff602462d168f32357bf6fedd18"
          },
          {
            "id": 4,
            "type": "handover",
            "kind": "customer_with_id",
            "label": "Customer holding national ID",
            "is_current": true,
            "captured_at": "2026-10-06T18:32:01+03:00",
            "url": "https://vivo.websacco.com/orders/api_files/handover/4/1791301321-7332bd39f67b62d50afd69c0",
            "url_expires_in": 600,
            "portal_url": "https://vivo.websacco.com/group/orders/photo/handover/4",
            "stored": true,
            "mime_type": "image/jpeg",
            "file_size": 18010,
            "width": 600,
            "height": 800,
            "sha256": "18125a225c86aa808ba59ab04dfc52aae56d8d64f2140de2faf98a4e61a25890"
          }
        ]
      },
      "expires_at": null,
      "created_at": "2026-10-06T18:32:00+03:00",
      "next": "done"
    }
  }
}

List my orders

POST/api/orders/get_orders

Lookups and cancel

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "limit": 20
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/get_orders" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "limit": 20
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300721,
    "data": {
      "items": [
        {
          "order_no": "ORD-1001",
          "status": "handed_over",
          "status_label": "Handed over",
          "customer": "Geoffrey Ongid",
          "device": "vivo Y28 8+256",
          "total": 42000,
          "created_at": "2026-10-06T18:32:00+03:00",
          "next": "done"
        }
      ],
      "limit": 20
    }
  }
}

List my open orders

POST/api/orders/get_orders

Lookups and cancel

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "open_only": true
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/get_orders" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "open_only": true
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Success",
    "time": 1791300721,
    "data": {
      "items": [],
      "limit": 20
    }
  }
}

Create an order to cancel

POST/api/orders/create_order

Lookups and cancel

A second customer's order, used by the next request.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2102",
    "product_id": 6,
    "idempotency_key": "072c2e50-7232-4449-9a83-fc8c2c530831"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/create_order" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "customer_id": "2102",
    "product_id": 6,
    "idempotency_key": "072c2e50-7232-4449-9a83-fc8c2c530831"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Order ORD-1002 created. Photograph the IMEI label next.",
    "time": 1791300721,
    "data": {
      "id": "ORD-1002",
      "order_id": 2,
      "status": "draft",
      "status_label": "Draft",
      "customer": {
        "id": 2102,
        "name": "Amina Hassan",
        "phone_masked": "254712***678"
      },
      "device": {
        "product_id": 6,
        "name": "vivo Y19s 4+128",
        "colour": null
      },
      "plan": {
        "id": 1,
        "name": "Standard 12 months",
        "version_id": 1,
        "price_id": 18
      },
      "quote": {
        "cash": 18000,
        "deposit": 3600,
        "daily": 60,
        "days": 360,
        "total": 25200
      },
      "imei": {
        "imei": null,
        "imei_2": null,
        "source": null,
        "last_ocr": null
      },
      "deposit": null,
      "agreement": null,
      "activation": null,
      "handover": {
        "photos": "0/4",
        "missing": [
          "provider_home",
          "app_home",
          "salesperson_with_customer",
          "customer_with_id"
        ],
        "ready_for_handover": false,
        "plan_no": null
      },
      "photos": {
        "imei_label": null,
        "handover": []
      },
      "expires_at": "2026-10-07T18:32:01+03:00",
      "created_at": "2026-10-06T18:32:01+03:00",
      "next": "imei"
    }
  }
}

Cancel order

POST/api/orders/cancel_order

Lookups and cancel

Unsigned orders only from the app; a signed order is refused with FORBIDDEN, a handed-over one with ORDER_STATE.

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1002",
    "reason": "Customer chose a different phone"
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/cancel_order" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7,
    "order_id": "ORD-1002",
    "reason": "Customer chose a different phone"
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Order cancelled and stock released.",
    "time": 1791300721,
    "data": {
      "order_no": "ORD-1002",
      "status": "cancelled",
      "refund_due": false
    }
  }
}

Endpoint list

POST/api/orders/index

Lookups and cancel

Sample request (JSON)
{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/orders/index" \
  -H "Content-Type: application/json" \
  -d '{
  "request_id": 1201,
  "api_key": "YOUR_API_KEY",
  "data": {
    "user_id": 7
  }
}'
Sample response
{
  "response": {
    "status": 1,
    "message": "Orders API",
    "time": 1791300721,
    "data": {
      "endpoints": {
        "create_order": "Create an order for an approved customer; reserves stock and fixes the price",
        "get_order": "One order with quote, IMEI, deposit, agreement, activation and handover state",
        "get_orders": "This salesperson's orders (filter: status, open_only)",
        "upload_imei_photo": "Photo of the IMEI label; the server reads the IMEI (OCR) and returns it",
        "confirm_imei": "Confirm the IMEI (pre-filled from OCR) and reserve the handset",
        "request_deposit": "Send the deposit STK push to the customer's own number",
        "deposit_status": "Poll the deposit: pending, paid, failed, cancelled, held",
        "generate_agreement": "Create the hire-purchase agreement once the deposit is paid",
        "send_sign_code": "SMS the signing code to the customer",
        "sign_agreement": "Customer signs by OTP; signatory countersigns; copy sent",
        "start_activation": "Enrol the handset with the locking provider through our layer",
        "activation_status": "Poll until the provider reports Active",
        "upload_handover_photo": "One of the four live handover photos",
        "handover_photos": "Which handover photos are on file",
        "order_photos": "Every photo on the order (IMEI label and handover, retakes included) with links",
        "record_handover": "Complete the handover; starts the plan",
        "cancel_order": "Cancel an unsigned order and release stock"
      }
    }
  }
}

Plans

Design

Payments after handover are not built yet. The requests follow the same conventions.

9.1 Customer pays (STK push)

Design · not built
POST/api/plans/pay
Sample request
{
  "request": {
    "request_id": 1201,
    "api_key": "CUSTOMER_APP_API_KEY",
    "data": {
      "user_id": 50,
      "plan_no": "HP-1001",
      "amount": 300,
      "payer_phone": "254748974489",
      "idempotency_key": "{{$guid}}"
    }
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/plans/pay" \
  -H "Content-Type: application/json" \
  -d '{
  "request": {
    "request_id": 1201,
    "api_key": "CUSTOMER_APP_API_KEY",
    "data": {
      "user_id": 50,
      "plan_no": "HP-1001",
      "amount": 300,
      "payer_phone": "254748974489",
      "idempotency_key": "{{$guid}}"
    }
  }
}'
Sample response

Not built yet; it will follow the same response envelope.

9.2 Paybill C2B

Design · not built
POST/plans/callbacks/c2b_confirmation
Sample request
{
  "TransactionType": "Pay Bill",
  "TransID": "S00AB12CD3",
  "TransTime": "20261005081522",
  "TransAmount": "300.00",
  "BusinessShortCode": "4325671",
  "BillRefNumber": "36955148",
  "MSISDN": "254748974489",
  "FirstName": "GEOFFREY"
}
Sample curl
curl -X POST "https://vivo.websacco.com/plans/callbacks/c2b_confirmation" \
  -H "Content-Type: application/json" \
  -d '{
  "TransactionType": "Pay Bill",
  "TransID": "S00AB12CD3",
  "TransTime": "20261005081522",
  "TransAmount": "300.00",
  "BusinessShortCode": "4325671",
  "BillRefNumber": "36955148",
  "MSISDN": "254748974489",
  "FirstName": "GEOFFREY"
}'
Sample response

Not built yet; it will follow the same response envelope.

9.3 Plan balance and days of use

Design · not built
POST/api/plans/get_plan
Sample request
{
  "request": {
    "request_id": 1201,
    "api_key": "YOUR_API_KEY",
    "data": {
      "user_id": 7,
      "plan_no": "HP-1001"
    }
  }
}
Sample curl
curl -X POST "https://vivo.websacco.com/api/plans/get_plan" \
  -H "Content-Type: application/json" \
  -d '{
  "request": {
    "request_id": 1201,
    "api_key": "YOUR_API_KEY",
    "data": {
      "user_id": 7,
      "plan_no": "HP-1001"
    }
  }
}'
Sample response

Not built yet; it will follow the same response envelope.

9.4 locking event after handover

Design · not built
POST/plans/callbacks/locking_event
Sample request
{
  "event": "state_changed",
  "imei": "354129071842263",
  "state": "Locked",
  "at": "2026-10-09T00:00:04+03:00"
}
Sample curl
curl -X POST "https://vivo.websacco.com/plans/callbacks/locking_event" \
  -H "Content-Type: application/json" \
  -d '{
  "event": "state_changed",
  "imei": "354129071842263",
  "state": "Locked",
  "at": "2026-10-09T00:00:04+03:00"
}'
Sample response

Not built yet; it will follow the same response envelope.