AfroPin Developers
Postman Sign in Get test keys

Stores

Add a store

Register a store where your customers can redeem PINs. Send its ID as store_id when redeeming so each payment is attributed to a store.

POST https://afropin.com/api/v1/brand/stores

HMAC-signed request with a unique Idempotency-Key header. Authentication

With an SDK
PHP$afropin->brand->stores->create($params)
Node.jsafropin.brand.stores.create(params)
Pythonafropin.brand.stores.create(params)
Javaafropin.brand().stores().create(params)

Body parameters

title string Required max 255

Store name.

address string Required max 255

Street address.

latitude numeric Required -90 to 90

Latitude in decimal degrees.

longitude numeric Required -180 to 180

Longitude in decimal degrees.

city string Required max 255

City.

state string Required

ISO2 code of a state in country, for example LA for Lagos. Any other value fails with invalid_state_iso2.

postal_code string Required max 255

Postal or ZIP code, checked against the format used in country.

country string Required 2 chars

ISO 3166-1 alpha-2 country code, in capitals, for example NG.

Locations are created active, in the mode of your API key: a test location cannot be used with live redemptions.

Location object

id uuid Required

Location ID. Send it as store_id when redeeming.

title string Required

Store name, saved with each word capitalised.

latitude string Required

Latitude, as a decimal string.

longitude string Required

Longitude, as a decimal string.

address string Required

Street address.

country string Required

ISO 3166-1 alpha-2 country code.

city string Required

City.

state string Required

State ISO2 code within the country.

postal_code string Required

Postal or ZIP code.

Request

{
    "title": "Lekki Phase 1 Store",
    "address": "12 Admiralty Way",
    "latitude": 6.4474,
    "longitude": 3.4723,
    "city": "Lagos",
    "state": "LA",
    "postal_code": "106104",
    "country": "NG"
}

Response 200

{
    "ok": true,
    "data": {
        "id": "5c1e8f2a-7b3d-4e19-a6c0-2d9f4b8e1a73",
        "title": "Lekki Phase 1 Store",
        "latitude": "6.4474",
        "longitude": "3.4723",
        "address": "12 Admiralty Way",
        "country": "NG",
        "city": "Lagos",
        "state": "LA",
        "postal_code": "106104"
    }
}

Errors

Failed requests return a stable code with a translated message. Branch on code, never on the message.

422 validation_error Some fields are missing or invalid
403 wrong_account_type Your account type cannot use this endpoint
422 invalid_country_iso2 country must be a two-letter ISO code we know
422 invalid_state_iso2 state must be the ISO code of a state in that country
422 invalid_postal_code postal_code is not in that country's format
429 rate_limited Too many requests. Wait a moment and try again
500 internal_error Something went wrong on our side. Try again; if it keeps happening, contact support
{
    "ok": false,
    "error": {
        "code": "wrong_account_type",
        "message": "Your account type cannot use this endpoint",
        "fields": null
    }
}
All error codes →