Ask a phone to pay

Sends a USSD push to the payer's phone and answers at once with the collection, `pending`. It becomes `succeeded` when Swichi has confirmed the money with the network, `failed` when the payer refuses or has too little, or `expired` when nobody answers in time. Needs the `collections` scope.

POST
/collections

Sends a USSD push to the payer's phone and answers at once with the collection, pending. It becomes succeeded when Swichi has confirmed the money with the network, failed when the payer refuses or has too little, or expired when nobody answers in time. Needs the collections scope.

Authorization

apiKey
AuthorizationBearer <token>

A Swichi Gateway payments key.

In: header

Header Parameters

Idempotency-Key*string

A unique value you keep and send again when you retry (up to 255 characters).

Lengthlength <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/collections" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "amount": 1,    "currency": "TZS",    "phone": "string"  }'
{  "id": "string",  "object": "collection",  "livemode": true,  "amount": 0,  "fee": 0,  "net": 0,  "currency": "TZS",  "status": "pending",  "network": "mpesa",  "phone": "string",  "reference": "string",  "description": "string",  "metadata": {    "property1": "string",    "property2": "string"  },  "failure": {    "code": "string",    "message": "string"  },  "receipt": "string",  "created_at": "2019-08-24T14:15:22Z",  "expires_at": "2019-08-24T14:15:22Z"}