Create payment link
curl --request POST \
--url https://api.palpluss.com/v1/payment-links \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1500,
"external_reference": "INV-2041",
"customer_name": "Jane",
"expiry": "72h",
"callbackUrl": "https://yourserver.com/webhooks/palpluss"
}
'import requests
url = "https://api.palpluss.com/v1/payment-links"
payload = {
"amount": 1500,
"external_reference": "INV-2041",
"customer_name": "Jane",
"expiry": "72h",
"callbackUrl": "https://yourserver.com/webhooks/palpluss"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1500,
external_reference: 'INV-2041',
customer_name: 'Jane',
expiry: '72h',
callbackUrl: 'https://yourserver.com/webhooks/palpluss'
})
};
fetch('https://api.palpluss.com/v1/payment-links', 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.palpluss.com/v1/payment-links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1500,
'external_reference' => 'INV-2041',
'customer_name' => 'Jane',
'expiry' => '72h',
'callbackUrl' => 'https://yourserver.com/webhooks/palpluss'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.palpluss.com/v1/payment-links"
payload := strings.NewReader("{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.post("https://api.palpluss.com/v1/payment-links")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.palpluss.com/v1/payment-links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "https://link.palpluss.com/8b1f…",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"currency": "KES",
"phone_number": "<string>",
"customer_name": "<string>",
"external_reference": "<string>",
"callback_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z"
},
"requestId": "c1b2a3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"error": {
"message": "Invalid phone number format.",
"code": "INVALID_PHONE",
"details": {}
},
"requestId": "a1b2c3d4-0000-0000-0000-000000000000"
}{
"success": false,
"error": {
"message": "Invalid or revoked API key.",
"code": "INVALID_API_KEY",
"details": {}
},
"requestId": "a1b2c3d4-0000-0000-0000-000000000000"
}{
"success": false,
"error": {
"message": "Invalid API key",
"code": "INVALID_API_KEY",
"details": {}
},
"requestId": "c1b2a3d4-e5f6-7890-abcd-ef1234567890"
}Payment Links
Create Payment Link
Create a hosted page where a customer pays by M-Pesa.
POST
/
payment-links
Create payment link
curl --request POST \
--url https://api.palpluss.com/v1/payment-links \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1500,
"external_reference": "INV-2041",
"customer_name": "Jane",
"expiry": "72h",
"callbackUrl": "https://yourserver.com/webhooks/palpluss"
}
'import requests
url = "https://api.palpluss.com/v1/payment-links"
payload = {
"amount": 1500,
"external_reference": "INV-2041",
"customer_name": "Jane",
"expiry": "72h",
"callbackUrl": "https://yourserver.com/webhooks/palpluss"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1500,
external_reference: 'INV-2041',
customer_name: 'Jane',
expiry: '72h',
callbackUrl: 'https://yourserver.com/webhooks/palpluss'
})
};
fetch('https://api.palpluss.com/v1/payment-links', 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.palpluss.com/v1/payment-links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1500,
'external_reference' => 'INV-2041',
'customer_name' => 'Jane',
'expiry' => '72h',
'callbackUrl' => 'https://yourserver.com/webhooks/palpluss'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.palpluss.com/v1/payment-links"
payload := strings.NewReader("{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.post("https://api.palpluss.com/v1/payment-links")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.palpluss.com/v1/payment-links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1500,\n \"external_reference\": \"INV-2041\",\n \"customer_name\": \"Jane\",\n \"expiry\": \"72h\",\n \"callbackUrl\": \"https://yourserver.com/webhooks/palpluss\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "https://link.palpluss.com/8b1f…",
"channel_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"currency": "KES",
"phone_number": "<string>",
"customer_name": "<string>",
"external_reference": "<string>",
"callback_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z"
},
"requestId": "c1b2a3d4-e5f6-7890-abcd-ef1234567890"
}{
"success": false,
"error": {
"message": "Invalid phone number format.",
"code": "INVALID_PHONE",
"details": {}
},
"requestId": "a1b2c3d4-0000-0000-0000-000000000000"
}{
"success": false,
"error": {
"message": "Invalid or revoked API key.",
"code": "INVALID_API_KEY",
"details": {}
},
"requestId": "a1b2c3d4-0000-0000-0000-000000000000"
}{
"success": false,
"error": {
"message": "Invalid API key",
"code": "INVALID_API_KEY",
"details": {}
},
"requestId": "c1b2a3d4-e5f6-7890-abcd-ef1234567890"
}Share the returned
url by SMS, WhatsApp or email. The customer opens it, enters their number (or confirms a pre-filled one) and pays by STK Push.
- Omit
amountto let the customer type it. - Payments appear as STK transactions and are sent to
callbackUrllike any STK Push. expiryis one of1h,6h,24h,72h,168h,720hornever(the default).- Live keys only. Test keys get
403 NOT_AVAILABLE_IN_TEST_MODE. MCP keys needpaylinks:write. - An account can have up to 10 payment links (active or disabled). The 11th returns
400 PAYLINK_LIMIT_REACHED. Delete a link you no longer need to make room.
Authorizations
Paste your PalPluss API key in the username field and leave the password field empty — it is ignored.
Get your key from console → API Keys. Live keys start with pp_live_,
test keys (simulated money) with pp_test_.
In your own code, send the key directly:
Authorization: Basic YOUR_API_KEY
Body
application/json