K2 Connect MPESA API code example

Example: K2 Connect MPESA API

POST https://sandbox.kopokopo.com/api/v1/incoming_payments
Content-Type: application/json
Accept: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
  "payment_channel": "M-PESA STK Push",
  "till_number": "K000000",
  "subscriber": {
    "first_name": "Joe",
    "last_name": "Buyer",
    "phone_number": "+254999999999"
    "email": "[email protected]"
  },
  "amount": {
    "currency": "KES",
    "value": 20000
  },
  "metadata":{
    "customer_id": "123456789",
    "reference": "123456",
    "notes": "Payment for invoice 12345"
  },
  "_links" : {
    "callback_url": "https://call_back_to_your_app.your_application.com"  
  }
}

HTTP/1.1 201 Created
Location: https://sandbox.kopokopo.com/api/v1/incoming_payments/247b1bd8-f5a0-4b71-a898-f62f67b8ae1c

Tags:

Misc Example