Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Adriano Faria Posted June 18, 2018 Posted June 18, 2018 @Mark, I'm working a resource that will allow purchases. Fine. The commission and fee goes to board account and I will use $item->payTo so the money goes to someone else. And here is the issue. This particular resource will introduce a third user to receive a slice of the money. An example? Something like a club: The board will receive 10% The user who is selling will receive 80% The club owner SHOULD receive the other 10% I actually didn't try yet so probably I'm making a dumb question without even try.. is it enough to use 2 payTo? Will this work? If so, how/where can I set the % for the seller and the "club" owner? Tks.
TheJackal84 Posted June 18, 2018 Posted June 18, 2018 4 minutes ago, Adriano Faria said: @Mark, I'm working a resource that will allow purchases. Fine. The commission and fee goes to board account and I will use $item->payTo so the money goes to someone else. And here is the issue. This particular resource will introduce a third user to receive a slice of the money. An example? Something like a club: The board will receive 10% The user who is selling will receive 80% The club owner SHOULD receive the other 10% I actually didn't try yet so probably I'm making a dumb question without even try.. is it enough to use 2 payTo? Will this work? If so, how/where can I set the % for the seller and the "club" owner? Tks. can you not run something via onPaid or somewhere like that to transfer it from x member to club owner? that way the member will receive say 80% then you will work out the owners 10% and take it from the member to add to the owner credit
Adriano Faria Posted June 18, 2018 Author Posted June 18, 2018 Just now, TheJackal84 said: can you not run something via onPaid or somewhere like that to transfer it from x member to club owner? that way the member will receive say 80% then you will work out the owners 10% and take it from the member to add to the owner credit Seems a bit weird but may work. Probably will do that if it hasn't a "clean" way.
Mark Posted June 18, 2018 Posted June 18, 2018 Afraid there isn't a straightforward way to do it. payTo can only handle one recipient.
TheJackal84 Posted June 18, 2018 Posted June 18, 2018 3 minutes ago, Adriano Faria said: Seems a bit weird but may work. Probably will do that if it hasn't a "clean" way. yeah it is not really the best way, but it could work if there is no other, you could send both emails in the onPaid as well so the member will not get one saying they got x $$$ then another saying x has been took
Adriano Faria Posted June 22, 2018 Author Posted June 22, 2018 On 6/18/2018 at 10:16 AM, Mark said: Afraid there isn't a straightforward way to do it. payTo can only handle one recipient. Any suggestions, Mark? I think I can’t run something in onPaid, as suggested by @TheJackal84, because the money is already deducted (tax and fee) and the rest goes to the payTo I indicate. Right?
TheJackal84 Posted June 22, 2018 Posted June 22, 2018 1 hour ago, Adriano Faria said: Any suggestions, Mark? I think I can’t run something in onPaid, as suggested by @TheJackal84, because the money is already deducted (tax and fee) and the rest goes to the payTo I indicate. Right? What if say the user gets 80% the board get 10% and the club owner gets 10%, via the invoice etc you would take 10% and payTo the club owner, pay 90% to the seller, under the $invoice->save(); add something like $extra = $invoice->status_extra; $extra['sitemoney'] = $The10PercentinTheirDefaultCurrency; $invoice->status_extra = $extra; $invoice->save(); now on the onPaid you will write a code to call the $invoice->status_extra['sitemoney'] and to remove it from the sellers account?, you will probably be sending emails for the amount gained etc but again write a code what calculates the 10% x2 then add that amount to the commission earned email.
TheJackal84 Posted June 22, 2018 Posted June 22, 2018 3 hours ago, Adriano Faria said: Any suggestions, Mark? I think I can’t run something in onPaid, as suggested by @TheJackal84, because the money is already deducted (tax and fee) and the rest goes to the payTo I indicate. Right? OK so I figured out a way, ( I was bored and intrested in this lol ) Do the invoice normally and then payTo the club owner his 10%, ( you can just use 90% as commission for the site as that is what it will be ) now under invoice save do something like this $totalPercent = \IPS\Settings::i()->club_owner_percent + \IPS\Settings::i()->sites_percent; $getTotal = $price->amount->percentage( $totalPercent ); $toPayOwner = new \IPS\nexus\Money( $price->amount->subtract( $getTotal ), $currency ); $extra = $invoice->status_extra; $extra['sellerscut'] = $toPayOwner; $invoice->status_extra = $extra; $invoice->save(); now if the item was $12 and the both % were set to 10% it will save as {"amount":"9.6","currency":"USD"} as 20% of $12 is $2.40, take $2.40 away from $12 is $9.60. In the onPaid call $invoice->status_extra['sellerscut'] and there you have the $9.60 to pay to the seller
Adriano Faria Posted June 22, 2018 Author Posted June 22, 2018 Very nice, tks mate. Will try as soon as I reach my PC. ?
Adriano Faria Posted June 26, 2018 Author Posted June 26, 2018 Thank you, @TheJackal84, worked like a charm! ?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.