Initiate payment
curl --request POST \
--url https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment \
--header 'Content-Type: application/json' \
--header 'x-api-secret: <x-api-secret>' \
--data '
{
"customer": {
"fullName": "Walk-in Customer",
"phoneNumber": "+251944719460",
"email": "customer@gmail.com"
},
"amount": 100,
"paymentInitiationType": "USSD_PUSH",
"items": [
{
"productId": "6812220726f547936d6c1976",
"quantity": 1,
"item_name": "mobile",
"unit_price": 500
}
],
"customerVat": 0.03,
"swift_code": "telebirr",
"callbackURL": "http://localhost:2222/starpay/complete_payment",
"currency": "ETB"
}
'import requests
url = "https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment"
payload = {
"customer": {
"fullName": "Walk-in Customer",
"phoneNumber": "+251944719460",
"email": "customer@gmail.com"
},
"amount": 100,
"paymentInitiationType": "USSD_PUSH",
"items": [
{
"productId": "6812220726f547936d6c1976",
"quantity": 1,
"item_name": "mobile",
"unit_price": 500
}
],
"customerVat": 0.03,
"swift_code": "telebirr",
"callbackURL": "http://localhost:2222/starpay/complete_payment",
"currency": "ETB"
}
headers = {
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-secret': '<x-api-secret>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
fullName: 'Walk-in Customer',
phoneNumber: '+251944719460',
email: 'customer@gmail.com'
},
amount: 100,
paymentInitiationType: 'USSD_PUSH',
items: [
{
productId: '6812220726f547936d6c1976',
quantity: 1,
item_name: 'mobile',
unit_price: 500
}
],
customerVat: 0.03,
swift_code: 'telebirr',
callbackURL: 'http://localhost:2222/starpay/complete_payment',
currency: 'ETB'
})
};
fetch('https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment', 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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment",
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([
'customer' => [
'fullName' => 'Walk-in Customer',
'phoneNumber' => '+251944719460',
'email' => 'customer@gmail.com'
],
'amount' => 100,
'paymentInitiationType' => 'USSD_PUSH',
'items' => [
[
'productId' => '6812220726f547936d6c1976',
'quantity' => 1,
'item_name' => 'mobile',
'unit_price' => 500
]
],
'customerVat' => 0.03,
'swift_code' => 'telebirr',
'callbackURL' => 'http://localhost:2222/starpay/complete_payment',
'currency' => 'ETB'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-secret: <x-api-secret>"
],
]);
$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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment"
payload := strings.NewReader("{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-secret", "<x-api-secret>")
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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Success",
"data": {
"bill_ref": "NC61HO4977",
"customer_name": "",
"messageId": "3f6f6bb43389d2WEG5JK"
}
}{
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "BadRequestException",
"message": "Missing required payload data, pk and payload is required"
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "GEN_004",
"message": "An unexpected server error occurred."
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "ABC_001",
"message": "not found"
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "GEN_004",
"message": "An unexpected server error occurred."
}
}Initiate payment
POST
/
erp
/
initiate-payment
Initiate payment
curl --request POST \
--url https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment \
--header 'Content-Type: application/json' \
--header 'x-api-secret: <x-api-secret>' \
--data '
{
"customer": {
"fullName": "Walk-in Customer",
"phoneNumber": "+251944719460",
"email": "customer@gmail.com"
},
"amount": 100,
"paymentInitiationType": "USSD_PUSH",
"items": [
{
"productId": "6812220726f547936d6c1976",
"quantity": 1,
"item_name": "mobile",
"unit_price": 500
}
],
"customerVat": 0.03,
"swift_code": "telebirr",
"callbackURL": "http://localhost:2222/starpay/complete_payment",
"currency": "ETB"
}
'import requests
url = "https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment"
payload = {
"customer": {
"fullName": "Walk-in Customer",
"phoneNumber": "+251944719460",
"email": "customer@gmail.com"
},
"amount": 100,
"paymentInitiationType": "USSD_PUSH",
"items": [
{
"productId": "6812220726f547936d6c1976",
"quantity": 1,
"item_name": "mobile",
"unit_price": 500
}
],
"customerVat": 0.03,
"swift_code": "telebirr",
"callbackURL": "http://localhost:2222/starpay/complete_payment",
"currency": "ETB"
}
headers = {
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-secret': '<x-api-secret>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
fullName: 'Walk-in Customer',
phoneNumber: '+251944719460',
email: 'customer@gmail.com'
},
amount: 100,
paymentInitiationType: 'USSD_PUSH',
items: [
{
productId: '6812220726f547936d6c1976',
quantity: 1,
item_name: 'mobile',
unit_price: 500
}
],
customerVat: 0.03,
swift_code: 'telebirr',
callbackURL: 'http://localhost:2222/starpay/complete_payment',
currency: 'ETB'
})
};
fetch('https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment', 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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment",
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([
'customer' => [
'fullName' => 'Walk-in Customer',
'phoneNumber' => '+251944719460',
'email' => 'customer@gmail.com'
],
'amount' => 100,
'paymentInitiationType' => 'USSD_PUSH',
'items' => [
[
'productId' => '6812220726f547936d6c1976',
'quantity' => 1,
'item_name' => 'mobile',
'unit_price' => 500
]
],
'customerVat' => 0.03,
'swift_code' => 'telebirr',
'callbackURL' => 'http://localhost:2222/starpay/complete_payment',
'currency' => 'ETB'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-secret: <x-api-secret>"
],
]);
$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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment"
payload := strings.NewReader("{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-secret", "<x-api-secret>")
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://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.starpayethiopia.com/v1/starpay-api/erp/initiate-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"fullName\": \"Walk-in Customer\",\n \"phoneNumber\": \"+251944719460\",\n \"email\": \"customer@gmail.com\"\n },\n \"amount\": 100,\n \"paymentInitiationType\": \"USSD_PUSH\",\n \"items\": [\n {\n \"productId\": \"6812220726f547936d6c1976\",\n \"quantity\": 1,\n \"item_name\": \"mobile\",\n \"unit_price\": 500\n }\n ],\n \"customerVat\": 0.03,\n \"swift_code\": \"telebirr\",\n \"callbackURL\": \"http://localhost:2222/starpay/complete_payment\",\n \"currency\": \"ETB\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"timestamp": "2023-11-07T05:31:56Z",
"message": "Success",
"data": {
"bill_ref": "NC61HO4977",
"customer_name": "",
"messageId": "3f6f6bb43389d2WEG5JK"
}
}{
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "BadRequestException",
"message": "Missing required payload data, pk and payload is required"
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "GEN_004",
"message": "An unexpected server error occurred."
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "ABC_001",
"message": "not found"
}
}{
"message": "Something wrong",
"status": "error",
"timestamp": "2025-05-07T07:31:30.824Z",
"path": "/v2/starpay-api/",
"error": {
"code": "GEN_004",
"message": "An unexpected server error occurred."
}
}Headers
API secret key.
Example:
"MFUxSN98EV5IUU+RhYZh2f866adcTa4F5HJ2dGI3t8+MH3cvfk/gAZ492TnxwdiI"
Required when paymentInitiationType is OTP.
Example:
"0a162ea504918e1c85f64da9733b64bf25ff400394f8e1da6cdfb656e1338b9a8fe47e1b32429f13b1495b075857bf98"
Body
application/json
Show child attributes
Show child attributes
Example:
100
Available options:
USSD_PUSH, LOCAL_CARD, INTERNATIONAL_CARD, QR, REFERENCE, OTP, CASH, IN_APP_PUSH Example:
"USSD_PUSH"
Show child attributes
Show child attributes
Example:
0.03
Example:
"telebirr"
Example:
"http://localhost:2222/starpay/complete_payment"
Example:
"ETB"
⌘I