Developer reference for the Raptors platform. Every operational phase — identity verification, reference issue, pricing, payment, USPS label issue, warehouse intake and Scan and Price, carriage, break-out, rider delivery, auction and settlement — with API calls, database writes, state transitions, notification triggers and financial postings documented at each step.
What this document is. The Scope of Work states what is being built. This states how it behaves at runtime — the sequence a developer implements and a tester verifies. Read them together.
Conventions. new means the capability does not exist today. upgrade means it exists and is being rebuilt. Endpoint paths are relative to /api/v1/. Every state change writes to package_events and to activity_log, and surfaces on the tracking page and the public API.
Four prefixes, four independent sequences. The prefix is the primary key the whole system reasons about — it appears on labels, in messages, on the tracking page and in every API response.
prefix + sequence in separate columns; concatenated for displayVerification happens on the site with the Ghana Card. No account prices, books or pays before approval. The RFC locker ID is issued at the moment of approval.
POST /packages, POST /payments and POST /labels/usps for any account not approved. The customer may browse prices and use the public calculator, but cannot commit. Attempts return 403 account_not_verified with a deep link. Implement this once, centrally — four separate checks is how one gets missed.GHA-XXXXXXXXX-X format/me/verification/admin/verification/{id}impersonating_customer_id alongside the real user_idactivity_log with staff member, client and durationOne engine serves the public calculator, item pages, the booking wizard, warehouse Scan and Price, the admin and the public API. A quote and a booking cannot disagree because they run the same code path.
price_source on the quote, so any price on the platform can be explained after the fact — needed for both customer disputes and Financial Sheet margin analysis.price_source = null at intake — not in the item catalogue and weight pricing does not apply/warehouse/{node}/scan-priceprice_source = scan_and_price| Category | Rule effect |
|---|---|
| General Goods | Standard customs and handling |
| Dangerous Goods | Declaration required; air carriage blocked until cleared |
| Electronics | Declared-value scrutiny; intake photo required; 2"×1" label option |
| Car Parts | Oversize handling; separate customs rates |
Two providers on the same networks, plus Hubtel bank transfer. Both normalise to one internal payment-event model, so nothing downstream knows which provider handled a transaction.
/payments/initiate with a client-generated idempotency keypayment_attempts with status=pendingpayments rows, each with its own method, provider, reference, amount, currency and dateunpaid → part_paid → paidamount_paid field — derive it, or the two go out of step the first time a refund landsrider_collections and the package releases immediately. That balance stays open until banked and cleared at end-of-day cash-up, reconciling into the Financial Sheet. A rider with an unreconciled balance above a configurable ceiling cannot be assigned new collect-on-delivery jobs.Real-time USPS pricing, payment on the site, and a printable label in three sizes — without the customer leaving Raptors.
| Size | Use |
|---|---|
| 4"×6" thermal | Standard packages; Zebra / Dymo, also PDF |
| A4 / Letter | Office or home printer, 2-up and 4-up |
| 2"×1" | Phones, tablets, small gadgets — peels off cleanly without damaging the item or its retail box |
| QR | Counter printing at a US Post Office |
cost_linesOne engine, two locations, separate stock. Every physical movement writes a ledger row, so stock can always be explained rather than merely counted.
/warehouse/{node}/intakeunidentified_stock with photographs, awaiting claimdamage_registerrevenue_lines — visible before the package ships, billed on releaseAir packages carry full waybill handling. Sea and courier packages are handled at package level. All three feed one consolidation engine.
cost_lines: airline charge, duty and levies paid on behalfdelivery_jobs row per recipient, carrying the package list, address, contacts and derived outstanding balancecost_lines: duty and levies, terminal handling, destination haulagerevenue_lines: clearance service fee, accrued storageDeliveries assigned to riders with a price on each job, a Raptors commission of 10–15%, and a rider view showing the delivery cost on every package.
/routes/{id}/assigndelivery_jobs.rider_fee at assignment and frozendelivery_jobs.commission_rate and commission_amount; configurable per rider or per zonecost_lines; commission posts as Raptors revenue/riders/me/manifest — jobs, fees, commission, collect amounts/riders/me/earningsEvery phase above posts here automatically. Nothing is typed in twice, and margin is known before delivery rather than after month end. Visible to Administration, Finance and Customer Service.
| Posted by | Revenue lines | Cost lines |
|---|---|---|
| Pricing engine (2) | Freight, weight charge, customs charge, handling | — |
| Discounts (2.3) | Negative revenue line, separately tracked | — |
| USPS labels (4) | Label handling fee | USPS postage, carrier collection cost |
| Warehouse (5) | Storage charges, repack charge | — |
| Air carriage (6) | Freight, fuel and security surcharge | Airline charge, duty and levies paid on behalf |
| Break-out (6.3) | Clearance service fee | Terminal handling, destination haulage |
| Last mile (7) | Delivery fee, re-delivery charge, rider commission | Rider fee per job |
| Payments (3) | — | Provider processing fees |
| Notifications | — | WhatsApp, SMS and media unit costs |
| Auctions (9) | Auction proceeds | Write-off on shortfall |
Uncollected packages have a defined, time-boxed path out of the warehouse, with notice and settlement.
| Stage | Timing | System behaviour |
|---|---|---|
| Available | Day 0 | ready_for_collection_at stamped at break-out or release. Customer notified. Clock starts. Storage charges continue to accrue. |
| Collection window | Weeks 1–3 | Normal ageing notifications at 7 and 14 days. Package remains fully in the customer's account. |
| Auction notice | Week 4 | Scheduled job flags the package auction_pending and fires notices on WhatsApp and email. Flagged in the admin auction queue. |
| Moves to auction | End week 4 | Status → auction. Package leaves the customer's account and live stock, and joins the auction list with photographs, category, weight and reserve price. |
| Settlement | After sale | Proceeds recorded against the customer's original debt. Any balance is written off or refunded, and posts to the Financial Sheet. |
Everything that happened, everything the customer can see, and everything a partner can pull.
user_id, role, action, entity type and id, before_json, after_json, timestamp, IP| Area | Endpoints | Scope |
|---|---|---|
| Tracking | GET /track/{reference} | Public — no key |
| Rates & quotes | POST /quotes/courier · /air · /sea · /item · /usps-label | read:rates |
| Packages | GET /packages · GET /packages/{ref} | read:packages |
| Invoices & payments | GET /invoices · GET /payments | read:invoices |
| Deliveries | GET /deliveries/{id} | read:deliveries |
| Webhooks | package.status.changed · payment.received · label.issued · delivery.completed | Per registered endpoint |
One dispatcher, four channels. Fires on every status change and every account activity.
| Channel | Provider | Used for |
|---|---|---|
| WhatsApp Business API | Primary channel — every status change and every activity, with PDF, image and video attachments | |
| SMS | Hubtel SMS with Ghanaian sender ID; mNotify or Hubtel SMS as fallback | OTPs, delivery PINs, out-for-delivery alerts, payment confirmations |
| SMTP | Invoices, receipts, PODs, verification outcomes, auction notices, password flows | |
| In-app | Notification centre | Persistent searchable history with deep links and unread count |
| Week | Build | Verifiable outcome |
|---|---|---|
| 1 | Requirements, designs, server setup; USPS and Hubtel applications lodged | Plan and designs signed off |
| 2 | Accounts, Ghana Card verification, RFC/RAP/RSP/RCP references, roles, activity log, settings | A customer registers, is verified, and receives an RFC |
| 3 | Pricing engine — items, weight, customs, categories, multicurrency, discounts, calculator | Any item prices in GHS and USD |
| 4 | Paystack, Hubtel, bank transfer, split payments, invoicing, Financial Sheet, debt | A customer pays in parts; the money and debt are visible |
| 5 | USPS pricing, labels in all three sizes, printing, tracking; warehouse intake, Scan and Price | A label issues; an unpriceable package is priced at intake |
| 6 | Air, sea and courier packages, consolidation, category export, tracking page with media | Full package lifecycle end to end |
| 7 | Last mile, rider pricing and commission, Riders page, POD, auctions, dashboards, incognito, API | A delivery completes with commission booked; an external key returns data |
| 8 | Bulk messaging with media, testing, corrections, data loading, training, go-live | Live and in use |