Skip to content

How can I pay in float instead of integer #927

Answered by rez1dent3
amit-eps asked this question in Q&A
Discussion options

You must be logged in to vote

Hello. The package architecture is built around integer. Non-float methods are called inside payments. This means that in this method you must specify the cost in int depending on your business processes. For example, if you are sure that all wallets will have decimal places =2, then you can multiply the amount by 100.

Example:

public function getAmountProduct(Customer $customer): float
{
//    return 5; // 0.05
//    return 50; // 0.5 
//    return 500; // 5  
    return 555; // 5.55 
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rez1dent3
Comment options

Answer selected by amit-eps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants