/// <summary> /// Makes a Business to Customer payment request. Paybill to Phone Number. /// </summary> /// <param name="businessToCustomerDto">B2C data transfer object.</param> /// <param name="accesstoken">Acccesstoken retrieved by the <c>GetAuthTokenAsync</c> method.</param> /// <param name="requestEndPoint">Set to <c>RequestEndPoint.BusinessToCustomer</c></param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>A JSON string containing data from MPESA API reposnse.</returns> /// <remarks> /// Suitable for refunds, rewards or just about any transaction that involves a business paying a customer. /// </remarks> public string MakeB2CPayment(BusinessToCustomerDto businessToCustomerDto, string accesstoken, string requestEndPoint, CancellationToken cancellationToken = default) { return(MpesaHttpRequest(businessToCustomerDto, accesstoken, requestEndPoint, cancellationToken).GetAwaiter().GetResult()); }
/// <summary> /// Makes a Business to Customer payment request. Paybill to Phone Number. /// </summary> /// <param name="businessToCustomerDto">B2C data transfer object.</param> /// <param name="accesstoken">Acccesstoken retrieved by the <c>GetAuthTokenAsync</c> method.</param> /// <param name="requestEndPoint">Set to <c>RequestEndPoint.BusinessToCustomer</c></param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>A JSON string containing data from MPESA API reposnse.</returns> /// <remarks> /// Suitable for refunds, rewards or just about any transaction that involves a business paying a customer. /// </remarks> public async Task <string> MakeB2CPaymentAsync(BusinessToCustomerDto businessToCustomerDto, string accesstoken, string requestEndPoint, CancellationToken cancellationToken = default) { return(await MpesaHttpRequest(businessToCustomerDto, accesstoken, requestEndPoint, cancellationToken)); }