Struct mpesa::services::MpesaExpressRequestBuilder
source · pub struct MpesaExpressRequestBuilder<'mpesa, Env: ApiEnvironment> { /* private fields */ }
Implementations§
source§impl<'mpesa, Env: ApiEnvironment> MpesaExpressRequestBuilder<'mpesa, Env>
impl<'mpesa, Env: ApiEnvironment> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn new( client: &'mpesa Mpesa<Env>, business_short_code: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn business_short_code(&'mpesa self) -> &'mpesa str
pub fn business_short_code(&'mpesa self) -> &'mpesa str
Public method get the business_short_code
sourcepub fn pass_key(
self,
pass_key: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn pass_key( self, pass_key: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
Your passkey. Optional in sandbox, will default to key provided in Safaricom’s test credentials Required in production
Errors
If thee pass_key
is invalid
sourcepub fn amount<Number: Into<f64>>(
self,
amount: Number
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn amount<Number: Into<f64>>( self, amount: Number ) -> MpesaExpressRequestBuilder<'mpesa, Env>
Adds an amount
to the request
This is a required field
sourcepub fn phone_number(
self,
phone_number: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn phone_number( self, phone_number: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn callback_url(
self,
callback_url: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn callback_url( self, callback_url: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn party_a(
self,
party_a: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn party_a( self, party_a: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn party_b(
self,
party_b: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn party_b( self, party_b: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn account_ref(
self,
account_ref: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn account_ref( self, account_ref: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
Optional - Used with M-Pesa PayBills.
sourcepub fn transaction_type(
self,
command_id: CommandId
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn transaction_type( self, command_id: CommandId ) -> MpesaExpressRequestBuilder<'mpesa, Env>
sourcepub fn transaction_desc(
self,
description: &'mpesa str
) -> MpesaExpressRequestBuilder<'mpesa, Env>
pub fn transaction_desc( self, description: &'mpesa str ) -> MpesaExpressRequestBuilder<'mpesa, Env>
A description of the transaction. Optional - defaults to “None”
sourcepub async fn send(self) -> MpesaResult<MpesaExpressRequestResponse>
pub async fn send(self) -> MpesaResult<MpesaExpressRequestResponse>
Lipa na M-Pesa Online Payment / Mpesa Express/ Stk push
Initiates a M-Pesa transaction on behalf of a customer using STK Push
A sucessfult request returns a MpesaExpressRequestResponse
type
Errors
Returns a MpesaError
on failure
Auto Trait Implementations§
impl<'mpesa, Env> !RefUnwindSafe for MpesaExpressRequestBuilder<'mpesa, Env>
impl<'mpesa, Env> !Send for MpesaExpressRequestBuilder<'mpesa, Env>
impl<'mpesa, Env> !Sync for MpesaExpressRequestBuilder<'mpesa, Env>
impl<'mpesa, Env> Unpin for MpesaExpressRequestBuilder<'mpesa, Env>
impl<'mpesa, Env> !UnwindSafe for MpesaExpressRequestBuilder<'mpesa, Env>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more