Class StkPushRequest
java.lang.Object
io.github.openpaydev.mpesa.core.models.StkPushRequest
Represents the complete request model for an M-Pesa STK Push API call.
This object is used to build a payment request. The recommended way to create an instance is
by using the static helper method newPayBillRequest(String, String, String, String, String).
The MpesaClient implementation will automatically populate the server-side fields
(BusinessShortCode, Password, Timestamp, etc.) before sending the
request.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleaninthashCode()static StkPushRequestnewPayBillRequest(String amount, String phoneNumber, String accountReference, String transactionDesc, String callBackURL) A convenient static factory method to create a standard PayBill STK Push request object.toString()
-
Method Details
-
newPayBillRequest
public static StkPushRequest newPayBillRequest(String amount, String phoneNumber, String accountReference, String transactionDesc, String callBackURL) A convenient static factory method to create a standard PayBill STK Push request object.This is the recommended way to create a new STK Push request.
- Parameters:
amount- The amount to be paid.phoneNumber- The customer's phone number in MSISDN format (e.g., "254712345678").accountReference- Your internal reference for the transaction (e.g., "invoice-123").transactionDesc- A short description of the payment (e.g., "Payment for shoes").callBackURL- Your public HTTPS callback URL for receiving the final status.- Returns:
- A new, populated
StkPushRequestinstance.
-
builder
-
toBuilder
-
getBusinessShortCode
-
getPassword
-
getTimestamp
-
getTransactionType
-
getAmount
-
getPartyA
-
getPartyB
-
getPhoneNumber
-
getCallBackURL
-
getAccountReference
-
getTransactionDesc
-
equals
-
hashCode
public int hashCode() -
toString
-