Skip to content

Instantly share code, notes, and snippets.

@JaniKibichi
Last active January 27, 2022 10:37
Show Gist options
  • Save JaniKibichi/4b58e0ff8452ae12858f0efe5091e2e3 to your computer and use it in GitHub Desktop.
Save JaniKibichi/4b58e0ff8452ae12858f0efe5091e2e3 to your computer and use it in GitHub Desktop.
Function to Calculate the 1.5% ZawadiPay Discount
public class Utilities {
public Utilities(){}
public static void launchMpesa(String phoneNumber,Float amount){
//Calculate Discount
Double newDiscAmt=(1 - 0.015)*amount;
//Send Mpesa checkout with sendMpesaCheckout method defined elsewhere based on daraja API
//Metadata CAN BE the MerchantID to be returned to the callback
sendMpesaCheckout (PRODUCT_NAME, phoneNumber,CURRENCY_CODE, newDiscAmt.floatValue(), metadata);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment