payfast icon indicating copy to clipboard operation
payfast copied to clipboard

Split payments

Open TechnoDezi opened this issue 4 years ago • 16 comments

Any idea when you will be adding split payments?

TechnoDezi avatar Apr 13 '20 14:04 TechnoDezi

Hi, I have not been following their updates recently. If you could maybe provide a link where I could see details around their api, I can plan some work on it.

louislewis2 avatar Apr 16 '20 15:04 louislewis2

Hi, have a look at https://developers.payfast.co.za/documentation/#split-payments

TechnoDezi avatar Apr 16 '20 15:04 TechnoDezi

Hello both, can you please tell me what is url for split payment, where to submit form data

harinderratton avatar Jul 22 '20 08:07 harinderratton

Hi

The split payment data gets submitted along with the other data to the same Url, the only difference is it is a Json string that has the split structure. Eg: { "split_payment" : { "merchant_id":10000105, "percentage":10, "amount":500, "min":100, "max":100000 } }

Not sure for this library how the fields would look as part of the Url.

TechnoDezi avatar Jul 22 '20 08:07 TechnoDezi

Big Thanks for your reply, One more genuine question is...you are sending one merchant id in string...but how to send to two merchants so that i can split payments in two parts for two merchants. I will be very thankful if you can help me

On Wed, 22 Jul 2020, 2:04 pm Dezi van Vuuren, [email protected] wrote:

Hi

The split payment data gets submitted along with the other data to the same Url, the only difference is it is a Json string that has the split structure. Eg: { "split_payment" : { "merchant_id":10000105, "percentage":10, "amount":500, "min":100, "max":100000 } }

Not sure for this library how the fields would look as part of the Url.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/louislewis2/payfast/issues/16#issuecomment-662322291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMTO6JG6WPQHWM4LHXOQHLR42QCTANCNFSM4MG7HDYA .

harinderratton avatar Jul 22 '20 08:07 harinderratton

Please read the documentation here: https://developers.payfast.co.za/documentation/#split-payments You can only split to one merchant at the moment. So the money will go to the Main receiver merchant, and then a portion gets split to another.

TechnoDezi avatar Jul 22 '20 08:07 TechnoDezi

i want to tell you what i wanna do exactly, I'm developing an food order App for south africa, and i have to implement Payfast for the payments, and according to my client's need, the payments will be split into two parts, one part will always go to the client and another part will go to the seller where user has placed order And i can not understand how to specify a particular seller id in my every api call...beacuse everytime seller may be different

harinderratton avatar Jul 22 '20 08:07 harinderratton

Hi

So what I've done on similar systems in the past is:

  • Seller captures their merchant details on their profile
  • Client merchant details is also captured or stored somewhere.
  • User buys from seller, they get redirected to payfast using the merchant details of the client (Main)
  • In doing so you configure a split payment to the Seller using their merchant details and the amount that they receive.

This way the users have a consistent experience of always paying the client, but every seller then gets their portion of the money.

The only problem comes in if a user is allowed to buy from multiple sellers, then payfast is not going to work as the split is limited to 1.

TechnoDezi avatar Jul 22 '20 08:07 TechnoDezi

okay @TechnoDezi Thank you very much I came to a solution that is.... 1). Create account for every seller and seller will add merchant id of main account to their accounts 2). Now customers will pay to seller account instead clients account. 3). In this way main admin will always get split payments from different sellers. ONLY THING TO NOTE: Main admin has to insure that every seller has put his merchant id to their account. he has to take account of every order that he is getting commissions or not

harinderratton avatar Jul 22 '20 09:07 harinderratton

Hi

You have just inverted everything I have said.

Can we take this offline? This conversation isn't part of this specific github issue? Send me a mail to [email protected]

Regards

TechnoDezi avatar Jul 22 '20 09:07 TechnoDezi

Hi,

sorry for the delay. I will be working on this library over the next day or so, when I visited the link provided, I could not see any useful info to implement the splits. I will re-check and let you know

louislewis2 avatar Aug 01 '20 16:08 louislewis2

Thanks, for the help. The api docs for payfast isn't the most help, so it might take some trial and error to get right.

TechnoDezi avatar Aug 02 '20 06:08 TechnoDezi

need help with this splits payfast docs does not help much

Naseem1981 avatar Feb 09 '21 13:02 Naseem1981

Just re-visiting this issue, is there a chance that split payments will be added to this project anytime soon?

The latest PayFast API docs link for this feature : https://developers.payfast.co.za/docs#splitpayments

garry-williams avatar Sep 26 '23 05:09 garry-williams

I will take a look at adding this, I am just waiting for PayFast to respond back to me, about a deserialization issue I keep encountering because of how they return data. The idea is to wait for their response, update the code in the event they fix their api, then to do a release. Right after that I will work on this. I have been waiting since the 16th of September though for a response.

Also to note, the pattern is changing with the next release, mainly the methods are now written as extension methods over the new integration client, in that class is where hashing, serializing, deserializing etc takes place, so anyone could easily extend the supported api's.

Example can be seen here https://github.com/louislewis2/payfast/blob/master/src/PayFast/Handlers/AdhocMethods.cs#L27-L29

louislewis2 avatar Sep 26 '23 14:09 louislewis2

@louislewis2 Appreciate the feedback! If anyone needs a quick solution. I found that if you append the json data for split payments onto the normal once-off request URL string in your own application then split payments get processed on the PayFast side. The split payments info should not be included in the signature hash, as per their docs, so that works with no modifications to the libraries.

garry-williams avatar Oct 06 '23 13:10 garry-williams