Reputation: 5363
I want to implement Mass Pay feature and looking over source code for php https://www.x.com/paypal-apis-masspay-php-5.3/soap
There is a snippet of a code that goes like this
for($i = 0; $i < 3; $i++) {
$receiverData = array( 'receiverEmail' => "[email protected]",
'amount' => "example_amount",
'uniqueID' => "example_unique_id",
'note' => "example_note");
$receiversArray[$i] = $receiverData;
}
What exactly is uniqueID and how does that get generated?
Upvotes: 0
Views: 434
Reputation: 11576
As I see in that page, PayPal doesn't force you to create uniqID with a specific method. So you have many options at this point.
Pseudos;
uniqid('', true);
sha1(uniqid(mt_rand(), true) . microtime());
hash('ripemd128', uniqid(mt_rand(), true) . microtime());
base64_encode(pack("H*", sha1(microtime())));
// should be more secure
bin2hex(mcrypt_create_iv(64, MCRYPT_DEV_URANDOM));
sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535),
mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535),
mt_rand(0, 65535), mt_rand(0, 65535));
$len = 128;
$str = '';
while ($len--) {
$str .= chr(rand(33,126));
}
$str = '';
$chars = str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ');
for ($i = 0; $i < 62; $i++) {
$str .= $chars[$i];
}
Upvotes: 0
Reputation: 26056
UniqueID would be your own internal ID you may have to identify the payment. You could generate it however you want.
In most cases it would be your customer ID or an order ID of some sort. Or just a payment record ID from your own system so you can easily cross-reference with PayPal.
Upvotes: 1