Skip to main content
PATCH
/
billpay
/
{billPayNumber}
cURL
curl --request PATCH \
  --url https://api.clickpesa.com/third-parties/billpay/{billPayNumber} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "billAmount": 50000,
  "billDescription": "Updated order description"
}
'
import requests

url = "https://api.clickpesa.com/third-parties/billpay/{billPayNumber}"

payload = {
    "billAmount": 50000,
    "billDescription": "Updated order description"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({billAmount: 50000, billDescription: 'Updated order description'})
};

fetch('https://api.clickpesa.com/third-parties/billpay/{billPayNumber}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.clickpesa.com/third-parties/billpay/{billPayNumber}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'billAmount' => 50000,
    'billDescription' => 'Updated order description'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.clickpesa.com/third-parties/billpay/{billPayNumber}"

	payload := strings.NewReader("{\n  \"billAmount\": 50000,\n  \"billDescription\": \"Updated order description\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.clickpesa.com/third-parties/billpay/{billPayNumber}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"billAmount\": 50000,\n  \"billDescription\": \"Updated order description\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.clickpesa.com/third-parties/billpay/{billPayNumber}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"billAmount\": 50000,\n  \"billDescription\": \"Updated order description\"\n}"

response = http.request(request)
puts response.read_body
{
  "billPayNumber": "55042914871931",
  "billAmount": 123,
  "billDescription": "<string>"
}
{
  "message": "billPayNumber is required"
}
{
  "message": "Unauthorized"
}
{
  "message": "BillPay Number does not exist"
}

Authorizations

Authorization
string
header
required

Authorization header containing the JWT access token returned from the generate token endpoint. The token already includes the Bearer prefix. Example: Authorization: Bearer eyJhbGciOi...

Path Parameters

billPayNumber
string
required

BillPay number to update

Body

application/json
billStatus
enum<string>

Status of the BillPay reference

Available options:
ACTIVE,
INACTIVE
billAmount
number

Amount of the bill (positive, max 2 decimal places)

Required range: x >= 0.01
billDescription
string

Description of the bill

Maximum string length: 500
billPaymentMode
enum<string>

Payment mode

Available options:
ALLOW_PARTIAL_AND_OVER_PAYMENT,
EXACT

Response

Successfully updated BillPay reference

billPayNumber
string

The BillPay reference number that was updated

Example:

"55042914871931"

billStatus
enum<string>

The updated status of the BillPay reference

Available options:
ACTIVE,
INACTIVE
billAmount
number

Amount of the bill

billDescription
string

Description of the bill

billPaymentMode
enum<string>

Payment mode

Available options:
ALLOW_PARTIAL_AND_OVER_PAYMENT,
EXACT