As described in "Use Mass Pay to Create an Affiliate System" [Hack #77], PayPal allows you to send
many payments at once through the PayPal web site. Using the Mass Pay
API and some slight modifications to the code in , you can also do this from
your own applications.
Setting up the Request
The first thing to do is set up a simple
tab-delimited text file that contains all
the information about your payees, as shown in .
Figure 1. Using a simple tab-delimited text file to store the information about the recipients of your payments
List the recipients' email addresses in the first
column and the corresponding payment amounts in the second column.
Include an optional third column to list a unique identifier for each
recipient for tracking and reconciliation purposes. The optional
fourth column lets you include a customized note to be sent to each
of your recipients.
Running the Hack
When you successfully execute the code , the Ack
code returned will be Success:
Timestamp: 4/27/2004 10:25:30 AM
Each payee is represented in the code as a
MassPayRequestItemType object. Create the initial
MassPayRequestItemType instance (line 1) and a BasicAmountType
instance that contains the amount, and add it to the item request.
Also create the recipient's email, unique ID, and
note, and add them to the item request.
Note that this code creates only one
object (line 2). You can repeat the steps
to fill in as many objects as you want and thus overcome the limit of
250 payees. Typically, the way to do this is to read the individual
item details from the tab-delimited file and create the objects on
the fly. That way, you should be able to create a list of
When you send a payment with Mass Pay, you pay the seller fees that would otherwise be
assessed to your recipients.
—Souvik Das, Rob Conery, and Dave