PaystackHQ / paystack-android

Paystack SDK for Android. Accept payments on Android
Apache License 2.0
126 stars 101 forks source link

Charge.setAmount( int amount) should be Charge.setAmount( double amount) #6

Closed uchechukwudim closed 7 years ago

uchechukwudim commented 7 years ago

Charge.setAmount( int amount) should be Charge.setAmount( double amount)

ibrahimlawal commented 7 years ago

charge.setAmount requires an int because you are setting kobo value. If you want to charge a hundred naira, you set amount as 100 * 100 = 10000. Hope that helps.

uchechukwudim commented 7 years ago

Hi Ibrahim thanks for the reply. This question probably sounds stupid but i'll ask anyway. So that will will mean if I want to charge anywhere from 1kobo to 90kobo I wont be doing any multiplication right or...? also when you want to charge 100.50 that mean it will be 105*105 yes?

ibrahimlawal commented 7 years ago

Hi @uchechukwudim,

Ha! No o!

If you want to charge 1 kobo, which is, 0.01 naira, you set 100 * 0.01 = 1 If you want to charge 90 kobo, which is, 0.90 naira, you set 100 * 0.90 = 90 If you want to charge 100.50 naira, you set 100 * 100.50 = 10050

Hope that helps.

uchechukwudim commented 7 years ago

Thank you very much for clarifying that out for me. When it comes to money one has to be extra sure sure. Talking about being extra sure. So the formula becomes: A constant 100 multiplied by actual amount (100 * Amount)? Yes?

ibrahimlawal commented 7 years ago

Yes, setAmount accepts the kobo value, which is: the naira value multiplied by 100.

uchechukwudim commented 7 years ago

Thank you very much for our quick response. I Appreciate. Have a nice day.

ibrahimlawal commented 7 years ago

Glad to be of assistance @uchechukwudim 👍