Skip to main content

Overview

The internet buy endpoint lets you purchase internet bundles for a customer’s account ID (router/device). Unlike mobile data, internet plans are tied to a fixed account rather than a phone number.

Authentication

Requires your merchant API key and the channel: API header.
Authorization: Bearer dcy_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
channel: API

Get internet plans

Before purchasing, fetch available plans from the catalog.
GET /api/v1/plans/internet
curl -sS "https://api.dancity.app/api/v1/plans/internet" \
  -H "Authorization: Bearer $DANCITY_API_KEY"

Buy internet bundle

POST /api/v1/internet/buy

Request body

FieldTypeRequiredDescription
planstringPlan _id from GET /plans/internet
accountidstringCustomer’s account/device ID
phonestringContact phone number
pinstring5-digit Dancity transaction PIN
customerRefstringYour internal reference ID
saveAsBeneficiarybooleanSave account as beneficiary
beneficiaryNamestringLabel for saved beneficiary
promocodestringDiscount promo code
The pin for internet purchases is 5 digits, unlike the 4-digit PIN used for airtime and data.
curl -sS -X POST "https://api.dancity.app/api/v1/internet/buy" \
  -H "Authorization: Bearer $DANCITY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "channel: API" \
  -d '{
    "plan": "64f1a2b3c4d5e6f7a8b9c0d2",
    "accountid": "SN1234567",
    "phone": "08012345678",
    "pin": "12345"
  }'

Full purchase flow

1. GET /api/v1/plans/internet
   → pick a plan, note its _id

2. Collect accountid and phone from your user

3. GET /api/v1/wallet
   → confirm sufficient balance

4. POST /api/v1/internet/buy
   → send plan._id, accountid, phone, pin
The accountid is provider-specific. Make sure you’re sending the correct identifier format for the chosen internet provider. An incorrect account ID will cause the purchase to fail.

Next steps