Created
August 26, 2015 21:22
-
-
Save vandershraaf/c09c70842de17231aee6 to your computer and use it in GitHub Desktop.
Adaptive payment with secondary receiver as fee payer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('PPBootStrap.php'); | |
require_once('Common/Constants.php'); | |
$receiver = array(); | |
// Receiver 1 | |
$receiver[0] = new Receiver(); | |
$receiver[0] -> email = "[email protected]"; | |
$receiver[0] -> amount = 4.00; | |
$receiver[0] -> primary = "true"; | |
// Receiver 2 | |
$receiver[1] = new Receiver(); | |
$receiver[1] -> email = "[email protected]"; | |
$receiver[1] -> amount = 3.75; | |
$receiver[1] -> primary = "false"; | |
$receiverList = new receiverList($receiver); | |
$payRequest = new PayRequest(new RequestEnvelope("en_US"), "PAY", "http://google.com", | |
"USD", $receiverList, "http://yahoo.com"); | |
$payRequest->feesPayer = "SECONDARYONLY"; | |
$payRequest->ipnNotificationUrl = "http://google.com"; | |
$payRequest->memo = "THIS IS A TEST"; | |
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig()); | |
try { | |
/* wrap API method calls on the service object with a try catch */ | |
$response = $service->Pay($payRequest); | |
} catch(Exception $ex) { | |
require_once 'Common/Error.php'; | |
exit; | |
} | |
print_r($response); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment