How to implement a "statement" on my site using PayPal?

I have a credit system set up on my website where user A can buy a document from user B, for example, suppose, for 1 credit and user account, B-accounts are credited, say, for 1 dollar. User B can "withdraw money" and receive the money that they earned on my PayPal account (on the site) in their PayPal account (suppose their email address is valid at the moment). When user A buys a loan, they are sent to PayPal, where they can log in and complete the purchase, for this I have an IPN listener configured on my site that stores credit information in my site database. However, I cannot find a mechanism for sending information about the "withdrawal of money" (that is, the user's email and the amount payable) to PayPal. To clarify: I understand that PayPal sends IPN when someone buys from me, but how can I send a message from my site to PayPal when the user clicks the cash out button? I saw the mention of Mass Pay, but can't seem to find any code samples. Am I missing something, or is there perhaps another (and better) way to do this? Thanks!

+4
source share
1 answer

You are correct that you need to use mass payment , and there is documentation for NVP and SOAP . Paypal sample code also has PHP NVP and SOAP .

What about the best way? I do not think there is with PayPal. You will pay another 2% for one payment (up to a maximum of $ 1) on top of what you paid to accept funds.

From the NVP code sample, the rough idea of ​​a simple encoding encoded URL is:

foreach($receiversArray as $i => $receiverData) { $receiverEmail = urlencode($receiverData['receiverEmail']); $amount = urlencode($receiverData['amount']); $uniqueID = urlencode($receiverData['uniqueID']); $note = urlencode($receiverData['note']); $nvpStr .= "&L_EMAIL$i=$receiverEmail&L_Amt$i=$amount&L_UNIQUEID$i=$uniqueID&L_NOTE$i=$note"; } 

Since you are already using IPN, from the MassPay API Doc :

If you have an instant payment account (IPN) for your account, PayPal will send two IPNs for each payment made while processing Mass Payment transactions. IPNs are sent to the notification URL specified in your account profile.

+3
source

Source: https://habr.com/ru/post/1303750/


All Articles