PrinPoll developer docs

Developers

Quick start

Get keys, make a request, create an event, test a payment, and receive a webhook.

Before you begin

Request and receive Developer access first. You need an approved account and API keys. For a test payment, use the sandbox deployment and a test key; test keys do not work on production.

1. Get keys

In the organizer dashboard, open Developers → API keys and create a secret key for server-side requests. Create a publishable key separately if you plan to use the embed widget. Secret keys are shown once when created or regenerated.

2. Make your first request

Check the key with GET /me. The API accepts a Bearer secret key for the server-side request.

JavaScript examples use fetch from your server runtime, not from browser code.

Check your key

curl --request GET \
  'https://api.prinpoll.com/api/partner/v1/me' \
  --header 'Authorization: Bearer sk_live_xxx'

3. Create an event

Create a vote event with POST /events. API events are Premium and live immediately. A vote event needs a category and an approved nominee before it is ready to accept payments; PrinPoll generates nominee USSD codes.

JavaScript API examples use fetch on your server. Do not copy secret-key examples into a browser bundle.

Create a vote event

curl --request POST \
  'https://api.prinpoll.com/api/partner/v1/events' \
  --header 'Authorization: Bearer sk_live_xxx' \
  --header 'Idempotency-Key: YOUR_UNIQUE_KEY' \
  --header 'Content-Type: application/json' \
  --data '{  "type": "vote",  "name": "Example Awards",  "description": "Annual awards voting",  "starts_at": "2030-01-01T00:00:00Z",  "ends_at": "2030-01-02T00:00:00Z",  "vote_cost": 100}'

Add a category and nominee

curl --request POST 'https://api.prinpoll.com/api/partner/v1/events/EVENT_ID/categories' \
  --header 'Authorization: Bearer sk_live_xxx' \
  --header 'Idempotency-Key: CATEGORY_CREATE_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Best Act"}'

curl --request POST 'https://api.prinpoll.com/api/partner/v1/categories/CATEGORY_ID/nominees' \
  --header 'Authorization: Bearer sk_live_xxx' \
  --header 'Idempotency-Key: NOMINEE_CREATE_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Nominee name","phone_number":"NOMINEE_GHANA_PHONE"}'

4. Take a test payment

Create the event and its vote content in the sandbox, then start a payment with POST /payments. Amounts are integer pesewas. Include an Idempotency-Key and keep the same value if you retry the same purchase attempt. Set SANDBOX_API_BASE_URL to the sandbox API base URL provided by PrinPoll.

Start a sandbox vote payment

curl --request POST \
  "$SANDBOX_API_BASE_URL/payments" \
  --header 'Authorization: Bearer sk_test_xxx' \
  --header 'Idempotency-Key: YOUR_UNIQUE_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "type": "vote",
    "event_id": "EVENT_ID",
    "nominee_id": "NOMINEE_ID",
    "votes": 3,
    "amount": 300,
    "phone_number": "0240000001",
    "network": "mtn"
  }'

This example uses 0240000001, the sandbox number that approves. Use the other documented test numbers to simulate a decline, delayed approval, or expiry.

5. Receive a webhook

Configure a webhook endpoint in the Developers dashboard and subscribe to payment.succeeded, vote.recorded, or ticket.issued. Verify each delivery against the raw request body and PrinPoll-Signature before processing it.

The webhook signing secret is shown once when created or regenerated. A delivery log is available in the dashboard, where failed or dead deliveries can be retried.