$executePaymentRequest->actionType = $_POST["actionType"];
/*
 * The ID of the funding plan from which to make this payment.
 */
if ($_POST["fundingPlanID"] != "") {
    $executePaymentRequest->fundingPlanId = $_POST["fundingPlanID"];
}
/*
* 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->ExecutePayment($executePaymentRequest);
} catch (Exception $ex) {
    require_once 'Common/Error.php';
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PayPal Adaptive Payments - Execute Payment</title>
<link href="Common/sdk.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Common/sdk_functions.js"></script>
</head>

<body>
	<div id="wrapper">
示例#2
0
 public function executePayment($param)
 {
     /*
     * The ExecutePayment API operation lets you execute a payment set up with the Pay API operation with the actionType CREATE. To pay receivers identified in the Pay call, set the pay key from the PayResponse message in the ExecutePaymentRequest message.
     		
     		The ExecutePayment API operation lets you execute a payment set up with the Pay API operation with the actionType CREATE. To pay receivers identified in the Pay call, set the pay key from the PayResponse message in the ExecutePaymentRequest message. 
     */
     /*
      * (Optional) The pay key that identifies the payment to be executed. This is the pay key returned in the PayResponse message. 
      */
     $executePaymentRequest = new ExecutePaymentRequest(new RequestEnvelope("en_US"), $param['payKey']);
     $executePaymentRequest->actionType = $param["actionType"];
     /*
      * The ID of the funding plan from which to make this payment.
      */
     if (isset($param["fundingPlanID"]) && $param["fundingPlanID"] != "") {
         $executePaymentRequest->fundingPlanId = $param["fundingPlanID"];
     }
     /*
     * 	 ## Creating service wrapper object
     		Creating service wrapper object to make API call and loading
     		Configuration::getAcctAndConfig() returns array that contains credential and config parameters
     */
     $service = new AdaptivePaymentsService($this->getAcctAndConfig());
     try {
         /* wrap API method calls on the service object with a try catch */
         $response = $service->ExecutePayment($executePaymentRequest);
     } catch (PayPal\Exception\PPConnectionException $ex) {
     } catch (Exception $ex) {
     }
     $ack = strtoupper($response->responseEnvelope->ack);
     if ($ack != "SUCCESS") {
         return (object) array("success" => false, "message" => "");
     } else {
         return (object) array("success" => true, "message" => "", "data" => $response);
     }
 }