Service Call: DoDirectPayment
public DoDirectPayment ( |
||
$doDirectPaymentReq | ||
$apiCredential | mixed | - Optional API credential - can either be a username configured in sdk_config.ini or a ICredential object created dynamically |
return |
$cardDetails->ExpYear = $_POST['expDateYear']; $cardDetails->CVV2 = $_POST['cvv2Number']; $cardDetails->CardOwner = $payer; $ddReqDetails = new DoDirectPaymentRequestDetailsType(); $ddReqDetails->CreditCard = $cardDetails; $ddReqDetails->PaymentDetails = $paymentDetails; $doDirectPaymentReq = new DoDirectPaymentReq(); $doDirectPaymentReq->DoDirectPaymentRequest = new DoDirectPaymentRequestType($ddReqDetails); /* * ## Creating service wrapper object Creating service wrapper object to make API call and loading Configuration::getAcctAndConfig() returns array that contains credential and config parameters */ $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig()); try { /* wrap API method calls on the service object with a try catch */ $doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq); } catch (Exception $ex) { include_once "../Error.php"; exit; } if (isset($doDirectPaymentResponse)) { echo "<table>"; echo "<tr><td>Ack :</td><td><div id='Ack'>{$doDirectPaymentResponse->Ack}</div> </td></tr>"; echo "<tr><td>TransactionID :</td><td><div id='TransactionID'>{$doDirectPaymentResponse->TransactionID}</div> </td></tr>"; echo "</table>"; echo "<pre>"; print_r($doDirectPaymentResponse); echo "</pre>"; } require_once '../Response.php';