Inheritance: extends PayPal\Core\PPBaseService
Beispiel #1
0
 public function sendMoney(array $params = [])
 {
     if (!$params) {
         return false;
     }
     $massPayReq = new MassPayReq();
     $massPayItemArray = array();
     $amount = new BasicAmountType("USD", $params['balance']);
     $massPayRequestItem = new MassPayRequestItemType($amount);
     $massPayRequestItem->ReceiverEmail = $params['email'];
     $massPayRequest = new MassPayRequestType($massPayRequestItem);
     $massPayReq->MassPayRequest = $massPayRequest;
     $service = new PayPalAPIInterfaceServiceService($this->_credentials);
     try {
         $response = $service->MassPay($massPayReq);
     } catch (Exception $ex) {
         return false;
     }
     return $response;
 }
Beispiel #2
0
 protected function doExpressCheckout($payerId, $token, $orderTotal)
 {
     $paymentDetail = new PaymentDetailsType();
     $paymentDetail->OrderTotal = $orderTotal;
     $paymentDetail->NotifyURL = $this->getIpnUrl();
     $DoExpressCheckoutRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
     $DoExpressCheckoutRequestDetails->PayerID = $payerId;
     $DoExpressCheckoutRequestDetails->Token = $token;
     $DoExpressCheckoutRequestDetails->PaymentDetails[0] = $paymentDetail;
     $DoExpressCheckoutPaymentRequestType = new DoExpressCheckoutPaymentRequestType();
     $DoExpressCheckoutPaymentRequestType->DoExpressCheckoutPaymentRequestDetails = $DoExpressCheckoutRequestDetails;
     $DoExpressCheckoutPaymentReq = new DoExpressCheckoutPaymentReq();
     $DoExpressCheckoutPaymentReq->DoExpressCheckoutPaymentRequest = $DoExpressCheckoutPaymentRequestType;
     return $this->payPalApi->DoExpressCheckoutPayment($DoExpressCheckoutPaymentReq);
 }
Beispiel #3
0
 * `Authorization ID` - Original authorization ID specifying the
 authorization to void or, to void an order, the order ID.
 `Important:
 If you are voiding a transaction that has been reauthorized, use the
 ID from the original authorization, and not the reauthorization.`
*/
$doVoidRequest->AuthorizationID = $_REQUEST['authID'];
$doVoidReq = new DoVoidReq();
$doVoidReq->DoVoidRequest = $doVoidRequest;
/*
 * 	 ## 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 */
    $doVoidResponse = $paypalService->DoVoid($doVoidReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($doVoidResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>" . $doVoidResponse->Ack . "</div> </td></tr>";
    echo "<tr><td>AuthorizationID :</td><td><div id='AuthorizationID'>" . $doVoidResponse->AuthorizationID . "</div></td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($doVoidResponse);
    echo "</pre>";
Beispiel #4
0
* `Start Date` - The earliest transaction date at which to start the
search.
*/
$transactionSearchRequest = new TransactionSearchRequestType();
$transactionSearchRequest->StartDate = $_REQUEST['startDate'];
$transactionSearchRequest->EndDate = $_REQUEST['endDate'];
$transactionSearchRequest->TransactionID = $_REQUEST['transactionID'];
$tranSearchReq = new TransactionSearchReq();
$tranSearchReq->TransactionSearchRequest = $transactionSearchRequest;
/*
 * 		 ## 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 */
    $transactionSearchResponse = $paypalService->TransactionSearch($tranSearchReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($transactionSearchResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$transactionSearchResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($transactionSearchResponse);
    echo "</pre>";
}
Note: Do not specify BUYNOW if BUTTONCODE=TOKEN; specify PAYMENT instead. Do not specify PAYMENT if BUTTONCODE=HOSTED. 
*/
$createButtonRequest->ButtonType = $_REQUEST['buttonType'];
$createButtonRequest->ButtonVar = $buttonVar;
if ($_REQUEST['buttonType'] == "PAYMENTPLAN") {
    $createButtonRequest->OptionDetails = array($optionDetails);
}
$createButtonReq = new BMCreateButtonReq();
$createButtonReq->BMCreateButtonRequest = $createButtonRequest;
/*
 * 	 ## 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 {
    $createButtonResponse = $paypalService->BMCreateButton($createButtonReq);
} catch (Exception $ex) {
    require '../Error.php';
    exit;
}
if (isset($createButtonResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$createButtonResponse->Ack}</div> </td></tr>";
    echo "<tr><td>HostedButtonID :</td><td><div id='HostedButtonID'>" . $createButtonResponse->HostedButtonID . "</div> </td></tr>";
    echo "<tr><td>Email :</td><td><div id='Email'>" . $createButtonResponse->Email . "</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($createButtonResponse);
    echo "</pre>";
 function getResponse()
 {
     $token = $_GET['token'];
     $getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
     $getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
     $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     /*
      * 	 ## 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 */
         $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
     } catch (Exception $ex) {
         if (isset($ex)) {
             $ex_message = $ex->getMessage();
             $ex_type = get_class($ex);
             if ($ex instanceof PPConnectionException) {
                 $ex_detailed_message = "Error connecting to " . $ex->getUrl();
             } else {
                 if ($ex instanceof PPMissingCredentialException || $ex instanceof PPInvalidCredentialException) {
                     $ex_detailed_message = $ex->errorMessage();
                 } else {
                     if ($ex instanceof PPConfigurationException) {
                         $ex_detailed_message = "Invalid configuration. Please check your configuration file";
                     }
                 }
             }
             print_r($ex_detailed_message);
         }
         exit;
     }
     if (isset($getECResponse)) {
         $payerId = urlencode($getECResponse->GetExpressCheckoutDetailsResponseDetails->PayerInfo->PayerID);
         $paymentAction = urlencode("Sale");
         $getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
         $getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
         $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
         /*
         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 */
             $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
         } catch (Exception $ex) {
             if (isset($ex)) {
                 $ex_message = $ex->getMessage();
                 $ex_type = get_class($ex);
                 if ($ex instanceof PPConnectionException) {
                     $ex_detailed_message = "Error connecting to " . $ex->getUrl();
                 } else {
                     if ($ex instanceof PPMissingCredentialException || $ex instanceof PPInvalidCredentialException) {
                         $ex_detailed_message = $ex->errorMessage();
                     } else {
                         if ($ex instanceof PPConfigurationException) {
                             $ex_detailed_message = "Invalid configuration. Please check your configuration file";
                         }
                     }
                 }
                 print_r($ex_detailed_message);
             }
             exit;
         }
         //----------------------------------------------------------------------------
         /*
          * The total cost of the transaction to the buyer. If shipping cost (not applicable to digital goods) and tax charges are known, include them in this value. If not, this value should be the current sub-total of the order. If the transaction includes one or more one-time purchases, this field must be equal to the sum of the purchases. Set this field to 0 if the transaction does not include a one-time purchase such as when you set up a billing agreement for a recurring payment that is not immediately charged. When the field is set to 0, purchase-specific fields are ignored.
          */
         $orderTotal = new BasicAmountType();
         $orderTotal->currencyID = "MXN";
         $orderTotal->value = $getECResponse->GetExpressCheckoutDetailsResponseDetails->PaymentDetails[0]->OrderTotal->value;
         $paymentDetails = new PaymentDetailsType();
         $paymentDetails->OrderTotal = $orderTotal;
         $DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
         $DoECRequestDetails->PayerID = $payerId;
         $DoECRequestDetails->Token = $token;
         $DoECRequestDetails->PaymentAction = $paymentAction;
         $DoECRequestDetails->PaymentDetails[0] = $paymentDetails;
         $DoECRequest = new DoExpressCheckoutPaymentRequestType();
         $DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
         $DoECReq = new DoExpressCheckoutPaymentReq();
         $DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
         try {
             /* wrap API method calls on the service object with a try catch */
             $DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
         } catch (Exception $ex) {
             if (isset($ex)) {
                 $ex_message = $ex->getMessage();
                 $ex_type = get_class($ex);
                 if ($ex instanceof PPConnectionException) {
                     $ex_detailed_message = "Error connecting to " . $ex->getUrl();
                 } else {
                     if ($ex instanceof PPMissingCredentialException || $ex instanceof PPInvalidCredentialException) {
                         $ex_detailed_message = $ex->errorMessage();
                     } else {
                         if ($ex instanceof PPConfigurationException) {
                             $ex_detailed_message = "Invalid configuration. Please check your configuration file";
                         }
                     }
                 }
                 print_r($ex_detailed_message);
             }
             exit;
         }
         if (isset($DoECResponse)) {
             if (isset($DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo)) {
                 $return = array('transactionID' => $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID, 'total' => $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->GrossAmount->value);
                 return $return;
             } else {
                 return false;
             }
         }
     }
 }
Beispiel #7
0
*/
$refundReqest->RefundSource = $_REQUEST['refundSource'];
$refundReqest->Memo = $_REQUEST['memo'];
/*
* 
  (Optional) Maximum time until you must retry the refund. 
*/
$refundReqest->RetryUntil = $_REQUEST['retryUntil'];
$refundReq = new RefundTransactionReq();
$refundReq->RefundTransactionRequest = $refundReqest;
/*
 * 	 ## 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 */
    $refundResponse = $paypalService->RefundTransaction($refundReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($refundResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$refundResponse->Ack}</div> </td></tr>";
    //echo "<tr><td>RefundStatus :</td><td><div id='RefundStatus'>$refundResponse->RefundInfo->RefundStatus</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($refundResponse);
    echo "</pre>";
$doNonRefCreditRequestDetails->CreditCard = $creditCard;
$doNonRefCreditRequestDetails->Comment = $_REQUEST['comment'];
$doNonRefCreditRequestDetails->NetAmount = $itemAmount;
$doNonRefCreditRequestDetails->ShippingAmount = $shippingAmount;
$doNonRefCreditRequestDetails->TaxAmount = $taxAmount;
$doNonRefCreditRequestDetails->Amount = $totalamount;
$doNonRefCreditRequest = new DoNonReferencedCreditRequestType();
$doNonRefCreditRequest->DoNonReferencedCreditRequestDetails = $doNonRefCreditRequestDetails;
$doNonRefCreditReq = new DoNonReferencedCreditReq();
$doNonRefCreditReq->DoNonReferencedCreditRequest = $doNonRefCreditRequest;
/*
 * 	 ## 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 */
    $doNonRefCreditResponse = $paypalService->DoNonReferencedCredit($doNonRefCreditReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($doNonRefCreditResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$doNonRefCreditResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($doNonRefCreditResponse);
    echo "</pre>";
}
Beispiel #9
0
 * The AddressVerify API operation confirms whether a postal address and postal code match those of the specified PayPal account holder.
 */
/*
 * Email address of a PayPal member to verify
 * First line of the billing or shipping postal address to verify. To pass verification, the value of Street must match the first 3 single-byte characters of a postal address on file for the PayPal member. 
 * Postal code to verify. To pass verification, the value of Zip must match the first 5 single-byte characters of the postal code of the verified postal address for the verified PayPal member.
 */
$addressVerifyRequest = new AddressVerifyRequestType($_REQUEST['mail'], $_REQUEST['street'], $_REQUEST['zip']);
$addrVerifyReq = new AddressVerifyReq();
$addrVerifyReq->AddressVerifyRequest = $addressVerifyRequest;
/*
 * 		// ## 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 */
    $addrVerifyResponse = $paypalService->AddressVerify($addrVerifyReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($addrVerifyResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$addrVerifyResponse->Ack}</div> </td></tr>";
    echo "<tr><td>StreetMatch :</td><td><div id='StreetMatch'>{$addrVerifyResponse->StreetMatch}</div> </td></tr>";
    echo "<tr><td>ZipMatch :</td><td><div id='ZipMatch'>{$addrVerifyResponse->ZipMatch}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($addrVerifyResponse);
Beispiel #10
0
This sample code uses Merchant PHP SDK to make API call
*/
/*
 * 		 A timestamped token, the value of which was returned by
`SetExpressCheckout` response.
*/
$token = $_REQUEST['token'];
$getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
$getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
$getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
/*
 * 	 ## 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 */
    $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($getECResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>" . $getECResponse->Ack . "</div> </td></tr>";
    echo "<tr><td>Token :</td><td><div id='Token'>" . $getECResponse->GetExpressCheckoutDetailsResponseDetails->Token . "</div></td></tr>";
    echo "<tr><td>PayerID :</td><td><div id='PayerID'>" . $getECResponse->GetExpressCheckoutDetailsResponseDetails->PayerInfo->PayerID . "</div></td></tr>";
    echo "<tr><td>PayerStatus :</td><td><div id='PayerStatus'>" . $getECResponse->GetExpressCheckoutDetailsResponseDetails->PayerInfo->PayerStatus . "</div></td></tr>";
    echo "</table>";
    echo '<pre>';
Beispiel #11
0
use PayPal\PayPalAPI\GetAuthDetailsReq;
use PayPal\PayPalAPI\GetAuthDetailsRequestType;
use PayPal\Service\PayPalAPIInterfaceServiceService;
require_once '../PPBootStrap.php';
/*
 *  If a token from the SetAuthFlowParam call is specified on input, the GetAuthDetails call can return a customer's Payer ID, PayPal email address, first name, and last name. 
 */
$reqType = new GetAuthDetailsRequestType($_REQUEST['token']);
$req = new GetAuthDetailsReq();
$req->GetAuthDetailsRequest = $reqType;
$logger->info("created GetAuthDetailsRequest Object");
/*
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 */
    $getAuthDetailsResponse = $paypalService->GetAuthDetails($req);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($getAuthDetailsResponse)) {
    echo "<pre>";
    print_r($getAuthDetailsResponse);
    echo "</pre>";
    if ($getAuthDetailsResponse->Ack == 'Success') {
        $payPalURL = 'https://www.sandbox.paypal.com/webscr&cmd=_account-authenticate-logout&token=' . $token;
        echo "<a href={$payPalURL}><b>* Redirect to paypal to logout</b></a><br>";
    }
/*
 * The GetTransactionDetails API operation obtains information about a specific transaction.
*/
$transactionDetails = new GetTransactionDetailsRequestType();
/*
 * Unique identifier of a transaction.
*/
$transactionDetails->TransactionID = $_POST['transID'];
$request = new GetTransactionDetailsReq();
$request->GetTransactionDetailsRequest = $transactionDetails;
/*
 * 	 ## 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 */
    $transDetailsResponse = $paypalService->GetTransactionDetails($request);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($transDetailsResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$transDetailsResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($transDetailsResponse);
    echo "</pre>";
}
Beispiel #13
0
 public function doExpressCheckout()
 {
     $token = urlencode($_REQUEST['token']);
     $payerId = urlencode($_REQUEST['PayerID']);
     $token = $_REQUEST['token'];
     $getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
     $getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
     $getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
     $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
     try {
         /** @var \PayPal\PayPalAPI\GetExpressCheckoutDetailsResponseType $getECResponse */
         $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
     } catch (Exception $ex) {
         echo $ex->getMessage();
     }
     $orderTotal = new BasicAmountType();
     $orderTotal->currencyID = $getECResponse->GetExpressCheckoutDetailsResponseDetails->PaymentDetails[0]->OrderTotal->currencyID;
     $orderTotal->value = $getECResponse->GetExpressCheckoutDetailsResponseDetails->PaymentDetails[0]->OrderTotal->value;
     //Details about each individual item included in the order.
     $itemDetails = new PaymentDetailsItemType();
     $itemDetails->Name = 'Sexy Plus Size V-Neck Short Sleeve Lace Hollow Out Dress(SKU189442)';
     $itemDetails->Amount = $orderTotal;
     $itemDetails->Quantity = '1';
     $itemDetails->ItemCategory = 'Digital';
     $PaymentDetails = new PaymentDetailsType();
     $PaymentDetails->PaymentDetailsItem[0] = $itemDetails;
     //$PaymentDetails->ShipToAddress = $address;
     $PaymentDetails->OrderTotal = $orderTotal;
     /*
      * How you want to obtain payment. When implementing parallel payments, this field is required and must be set to Order. When implementing digital goods, this field is required and must be set to Sale.
      */
     $PaymentDetails->PaymentAction = 'Sale';
     $PaymentDetails->ItemTotal = $orderTotal;
     $DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
     $DoECRequestDetails->PayerID = $payerId;
     $DoECRequestDetails->Token = $token;
     $DoECRequestDetails->PaymentDetails[0] = $PaymentDetails;
     $DoECRequest = new DoExpressCheckoutPaymentRequestType();
     $DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
     $DoECReq = new DoExpressCheckoutPaymentReq();
     $DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
     $paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
     $DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
     //var_dump($DoECResponse);
     if ($DoECResponse->Ack == 'Success') {
         $this->successExpressCheckout();
     } else {
         echo "failed, please contact us: cservice@pandoraf.com!";
         exit;
     }
 }
 * The ManagePendingTransactionStatus API operation accepts or denys a pending transaction held by Fraud Management Filters. 
 */
/*
 * (Required) The transaction ID of the payment transaction. 
 * 
 * (Required) The operation you want to perform on the transaction. It is one of the following values:
   Accept – Accepts the payment
   Deny – Rejects the payment
*/
$MPTranStatusReqest = new ManagePendingTransactionStatusRequestType($_REQUEST['transactionID'], $_REQUEST['action']);
$MPTranStatusReq = new ManagePendingTransactionStatusReq();
$MPTranStatusReq->ManagePendingTransactionStatusRequest = $MPTranStatusReqest;
/*
 * 	 ## 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 */
    $MPTranStatusResponse = $paypalService->ManagePendingTransactionStatus($MPTranStatusReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($MPTranStatusResponse)) {
    echo "<pre>";
    print_r($MPTranStatusResponse);
    echo "</pre>";
}
require_once '../Response.php';
use PayPal\PayPalAPI\BAUpdateRequestType;
use PayPal\PayPalAPI\BillAgreementUpdateReq;
use PayPal\Service\PayPalAPIInterfaceServiceService;
require_once '../PPBootStrap.php';
/*
 * update billing agreement
 */
$BAUpdateRequest = new BAUpdateRequestType($_REQUEST['referenceID']);
$BAUpdateRequest->BillingAgreementStatus = $_REQUEST['billingAgreementStatus'];
$BAUpdateRequest->BillingAgreementDescription = $_REQUEST['billingAgreementDescription'];
$billingAgreementUpdateReq = new BillAgreementUpdateReq();
$billingAgreementUpdateReq->BAUpdateRequest = $BAUpdateRequest;
/*
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 */
    $BAUpdatResponse = $paypalService->BillAgreementUpdate($billingAgreementUpdateReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($BAUpdatResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$BAUpdatResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($BAUpdatResponse);
    echo "</pre>";
}
*/
$token = urlencode($_REQUEST['token']);
/*
 *  Unique PayPal buyer account identification number as returned in the GetExpressCheckoutDetails response
*/
$payerId = urlencode($_REQUEST['payerID']);
$paymentAction = urlencode($_REQUEST['paymentAction']);
// ------------------------------------------------------------------
// this section is optional if parameters required for DoExpressCheckout is retrieved from your database
$getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType($token);
$getExpressCheckoutReq = new GetExpressCheckoutDetailsReq();
$getExpressCheckoutReq->GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest;
/*
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 */
    $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
//----------------------------------------------------------------------------
/*
 * The total cost of the transaction to the buyer. If shipping cost (not applicable to digital goods) and tax charges are known, include them in this value. If not, this value should be the current sub-total of the order. If the transaction includes one or more one-time purchases, this field must be equal to the sum of the purchases. Set this field to 0 if the transaction does not include a one-time purchase such as when you set up a billing agreement for a recurring payment that is not immediately charged. When the field is set to 0, purchase-specific fields are ignored.
*/
$orderTotal = new BasicAmountType();
$orderTotal->currencyID = $_REQUEST['currencyCode'];
$orderTotal->value = $_REQUEST['amt'];
$paymentDetails = new PaymentDetailsType();
(Required) Whether to track the gross profit associated with inventory changes. It is one of the following values:

   0 - do not track the gross profit

   1 - track the gross profit

Note: The gross profit is calculated as the price of the item less its cost, multiplied by the change in the inventory level since the last call to BMSetInventory
*/
$bmSetInventoryReqest = new BMSetInventoryRequestType($_REQUEST['hostedID'], $_REQUEST['trackInv'], $_REQUEST['trackPnl']);
$bmSetInventoryReqest->ItemTrackingDetails = $itemTrackingDetails;
$bmSetInventoryReq = new BMSetInventoryReq();
$bmSetInventoryReq->BMSetInventoryRequest = $bmSetInventoryReqest;
/*
 * 	 ## 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 {
    $bmSetInventoryResponse = $paypalService->BMSetInventory($bmSetInventoryReq);
} catch (Exception $ex) {
    require '../Error.php';
    exit;
}
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$bmSetInventoryResponse->Ack}</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($bmSetInventoryResponse);
echo "</pre>";
require_once '../Response.php';
Beispiel #18
0
/*
 *  `DoAuthorizationRequest` which takes mandatory params:

* `Transaction ID` - Value of the order's transaction identification
number returned by PayPal.
* `Amount` - Amount to authorize.
*/
$doAuthRequest = new DoAuthorizationRequestType($_REQUEST['transID'], $amount);
$doAuthReq = new DoAuthorizationReq();
$doAuthReq->DoAuthorizationRequest = $doAuthRequest;
/*
 *  ## 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 */
    $doAuthResponse = $paypalService->DoAuthorization($doAuthReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($doAuthResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>" . $doAuthResponse->Ack . "</div> </td></tr>";
    echo "<tr><td>TransactionID :</td><td><div id='TransactionID'>" . $doAuthResponse->TransactionID . "</div></td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($doAuthResponse);
    echo "</pre>";
 /**
  * Refund the transaction
  */
 static function refund($id, $force_refund = FALSE)
 {
     $transaction = Transaction::find($id);
     // Get Plan data
     $plan = Plan::where('id', '=', $transaction->plan_id)->first();
     // Get purchase data
     $purchase = Purchase::where('id', '=', $transaction->purchase_id)->first();
     if ($transaction->purchase->pay_method == 1) {
         // Add Stripe library
         require_once app_path() . "/libraries/stripe-php-1.9.0/lib/Stripe.php";
         // Add Stripe library
         Stripe::setApiKey(Config::get('project.stripe_secret_key'));
         try {
             $ch = Stripe_Charge::retrieve($transaction->pay_id);
             $ch->refund();
         } catch (Exception $e) {
             $error = TRUE;
         }
         // If Split pay then cancel subscription as well
         if ($plan->has_split_pay) {
             $at_period_end = FALSE;
             $customer = $purchase->stripe_token;
             $subscription_id = NULL;
             try {
                 $cu = Stripe_Customer::retrieve($customer);
                 $subscriptions = $cu->subscriptions->all(array('count' => 100));
                 foreach ($subscriptions->data as $subscription) {
                     if ($subscription->plan->id == $plan_id) {
                         if ($subscription->status == 'active') {
                             $subscription_id = $subscription->id;
                             break;
                         }
                     }
                 }
                 $cu->subscriptions->retrieve($subscription_id)->cancel(array('at_period_end' => $at_period_end));
             } catch (Exception $e) {
                 $error = TRUE;
             }
         }
     } elseif ($transaction->purchase->pay_method == 2) {
         $config = array('mode' => Config::get('project.paypal_mode'), 'acct1.UserName' => Config::get('project.paypal_api_username'), 'acct1.Password' => Config::get('project.paypal_api_password'), 'acct1.Signature' => Config::get('project.paypal_api_signature'));
         /*
         * The RefundTransaction API operation issues a refund to the PayPal account holder associated with a transaction. 
         This sample code uses Merchant PHP SDK to make API call
         */
         $refundReqest = new PayPal\PayPalAPI\RefundTransactionRequestType();
         /*
         *          Type of refund you are making. It is one of the following values:
                        
                         * `Full` - Full refund (default).
                         * `Partial` - Partial refund.
                         * `ExternalDispute` - External dispute. (Value available since
                         version
                         82.0)
                         * `Other` - Other type of refund. (Value available since version
                         82.0)
         */
         $refundReqest->RefundType = 'Full';
         /*
         *  Either the `transaction ID` or the `payer ID` must be specified.
                         PayerID is unique encrypted merchant identification number
                         For setting `payerId`,
                         `refundTransactionRequest.setPayerID("A9BVYX8XCR9ZQ");`
         
                         Unique identifier of the transaction to be refunded.
         */
         $refundReqest->TransactionID = $transaction->pay_id;
         /*
                      *  (Optional)Type of PayPal funding source (balance or eCheck) that can be used for auto refund. It is one of the following values:
            any – The merchant does not have a preference. Use any available funding source.
            default – Use the merchant's preferred funding source, as configured in the merchant's profile.
            instant – Use the merchant's balance as the funding source.
            eCheck – The merchant prefers using the eCheck funding source. If the merchant's PayPal balance can cover the refund amount, use the PayPal balance.
         */
         //$refundReqest->RefundSource = $_REQUEST['refundSource'];
         $refundReqest->Memo = "Refunded from Digital Kickstart App";
         /*
         * 
           (Optional) Maximum time until you must retry the refund. 
         */
         //$refundReqest->RetryUntil = $_REQUEST['retryUntil'];
         $refundReq = new PayPal\PayPalAPI\RefundTransactionReq();
         $refundReq->RefundTransactionRequest = $refundReqest;
         /*
          *          ## 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 PayPal\Service\PayPalAPIInterfaceServiceService($config);
         try {
             /* wrap API method calls on the service object with a try catch */
             $refundResponse = $paypalService->RefundTransaction($refundReq);
         } catch (Exception $ex) {
             $error = TRUE;
         }
         // If Split pay then cancel subscription as well
         if ($plan->has_split_pay) {
             $paypal_sub_id = $purchase->paypal_sub_id;
             /*
              * The ManageRecurringPaymentsProfileStatus API operation cancels, suspends, or reactivates a recurring payments profile. 
              */
             $manageRPPStatusReqestDetails = new ManageRecurringPaymentsProfileStatusRequestDetailsType();
             /*
                              *  (Required) The action to be performed to the recurring payments profile. Must be one of the following:
                Cancel – Only profiles in Active or Suspended state can be canceled.
                Suspend – Only profiles in Active state can be suspended.
                Reactivate – Only profiles in a suspended state can be reactivated.
             */
             $manageRPPStatusReqestDetails->Action = 'Cancel';
             /*
              * (Required) Recurring payments profile ID returned in the CreateRecurringPaymentsProfile response.
              */
             $manageRPPStatusReqestDetails->ProfileID = $paypal_sub_id;
             $manageRPPStatusReqest = new ManageRecurringPaymentsProfileStatusRequestType();
             $manageRPPStatusReqest->ManageRecurringPaymentsProfileStatusRequestDetails = $manageRPPStatusReqestDetails;
             $manageRPPStatusReq = new ManageRecurringPaymentsProfileStatusReq();
             $manageRPPStatusReq->ManageRecurringPaymentsProfileStatusRequest = $manageRPPStatusReqest;
             /*
              *   ## 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($config);
             try {
                 /* wrap API method calls on the service object with a try catch */
                 $manageRPPStatusResponse = $paypalService->ManageRecurringPaymentsProfileStatus($manageRPPStatusReq);
             } catch (Exception $ex) {
                 $error = TRUE;
             }
             if (isset($manageRPPStatusResponse) and $manageRPPStatusResponse->Ack == 'Success') {
                 // Do nothing
             } else {
                 $error = TRUE;
             }
         }
     }
     if (empty($error) or $force_refund) {
         self::completeRefund($transaction);
         return TRUE;
     }
 }
    $creditCard->ExpMonth = $_REQUEST['expMonth'];
    $creditCard->ExpYear = $_REQUEST['expYear'];
    $updateRPProfileRequestDetail->CreditCard = $creditCard;
}
//(Required) Recurring payments profile ID returned in the CreateRecurringPaymentsProfile response.
$updateRPProfileRequestDetail->ProfileID = $_REQUEST['profileID'];
$updateRPProfileRequest = new UpdateRecurringPaymentsProfileRequestType();
$updateRPProfileRequest->UpdateRecurringPaymentsProfileRequestDetails = $updateRPProfileRequestDetail;
$updateRPProfileReq = new UpdateRecurringPaymentsProfileReq();
$updateRPProfileReq->UpdateRecurringPaymentsProfileRequest = $updateRPProfileRequest;
/*
 *  ## 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 */
    $updateRPProfileResponse = $paypalService->UpdateRecurringPaymentsProfile($updateRPProfileReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($updateRPProfileResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$updateRPProfileResponse->Ack}</div> </td></tr>";
    echo "<tr><td>ProfileID :</td><td><div id='ProfileID'>" . $updateRPProfileResponse->UpdateRecurringPaymentsProfileResponseDetails->ProfileID . "</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($updateRPProfileResponse);
    echo "</pre>";
$bmManageButtonStatusReqest = new BMManageButtonStatusRequestType();
/*
 * (Required) The ID of the hosted button whose status you want to change.
 */
$bmManageButtonStatusReqest->HostedButtonID = $_REQUEST['hostedID'];
/*
 *  (Required) The new status of the button. It is one of the following values:
   DELETE - the button is deleted from PayPal
*/
$bmManageButtonStatusReqest->ButtonStatus = $_REQUEST['buttonStatus'];
$BMManageButtonStatusReq = new BMManageButtonStatusReq();
$BMManageButtonStatusReq->BMManageButtonStatusRequest = $bmManageButtonStatusReqest;
/*
 * 	 ## 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 {
    $bmManageButtonStatusResponse = $paypalService->BMManageButtonStatus($BMManageButtonStatusReq);
} catch (Exception $ex) {
    require '../Error.php';
    exit;
}
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$bmManageButtonStatusResponse->Ack}</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($bmManageButtonStatusResponse);
echo "</pre>";
require_once '../Response.php';
Beispiel #22
0
 /**
  * Get express checkout payment request response
  * 
  * @param string $payerId         
  * @param array $order     
  * @return PayPalAPI\DoExpressCheckoutPaymentResponseType     
  */
 public function getECPaymentResponse($payerId, $token, array $order)
 {
     $DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
     $DoECRequestDetails->PayerID = $payerId;
     $DoECRequestDetails->Token = $token;
     $DoECRequestDetails->PaymentAction = 'Sale';
     $paymentDetails = new PaymentDetailsType();
     $paymentDetails->OrderTotal = new BasicAmountType($order['currency'], $order['amount']);
     $paymentDetails->NotifyURL = Config::$a['paypal']['api']['ipn'];
     $DoECRequestDetails->PaymentDetails[0] = $paymentDetails;
     $DoECRequest = new DoExpressCheckoutPaymentRequestType();
     $DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
     $DoECReq = new DoExpressCheckoutPaymentReq();
     $DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
     $paypalService = new PayPalAPIInterfaceServiceService();
     return $paypalService->DoExpressCheckoutPayment($DoECReq);
 }
Beispiel #23
0
   1 � PayPal does not display shipping address fields whatsoever.
   2 � If you do not pass the shipping address, PayPal obtains it from the buyer's account profile.
*/
$setECReqDetails->NoShipping = 1;
$setECReqType = new SetExpressCheckoutRequestType();
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;
$setECReq = new SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;
// storing in session to use in DoExpressCheckout
$_SESSION['amount'] = $_REQUEST['amount'];
$_SESSION['currencyID'] = $_REQUEST['currencyId'];
/*
 * 	 ## 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());
$setECResponse = $paypalService->SetExpressCheckout($setECReq);
// echo '<pre>';
//print_r($setECResponse);
// echo '</pre>';
if ($setECResponse->Ack == 'Success') {
    $token = $setECResponse->Token;
    /*
    		$payPalURL = 'https://www.sandbox.paypal.com/incontext?token=' . $token;
    	header("Location: ".$payPalURL);*/
    echo "<br><br><br><br><br><br><br><br><a href=https://www.sandbox.paypal.com/incontext?token={$token} />Click here to continue to https://www.sandbox.paypal.com/incontext?token={$token}</a>";
} else {
    var_dump($setECResponse);
    echo "error in SetEC API call";
}
    $RTRequestDetails->CreditCard = $creditCard;
}
$RTRequestDetails->PaymentDetails = $paymentDetails;
$RTRequestDetails->ReferenceID = $_REQUEST['referenceID'];
$RTRequestDetails->PaymentAction = $_REQUEST['paymentAction'];
$RTRequestDetails->PaymentType = $_REQUEST['paymentType'];
$RTRequest = new DoReferenceTransactionRequestType();
$RTRequest->DoReferenceTransactionRequestDetails = $RTRequestDetails;
$RTReq = new DoReferenceTransactionReq();
$RTReq->DoReferenceTransactionRequest = $RTRequest;
/*
## 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 */
    $RTResponse = $paypalService->DoReferenceTransaction($RTReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($RTResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$RTResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($RTResponse);
    echo "</pre>";
}
*/
$PaymentDetails->ItemTotal = $orderTotal;
$DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType();
$DoECRequestDetails->PayerID = $payerId;
$DoECRequestDetails->Token = $token;
$DoECRequestDetails->PaymentDetails[0] = $PaymentDetails;
$DoECRequest = new DoExpressCheckoutPaymentRequestType();
$DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails;
$DoECReq = new DoExpressCheckoutPaymentReq();
$DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest;
/*
 * 	 ## 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());
$DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq);
//var_dump($DoECResponse);
if ($DoECResponse->Ack == 'Success') {
    ?>
<html>
<script>
alert("Payment Successful")
top.dg.closeFlow();
</script>
<?php 
    /*
     * TODO: add your logic that handles successful payment
    */
} else {
    ?>
$buttonSearchRequest = new BMButtonSearchRequestType();
/*
 * (Required) Starting date for the search. The value must be in UTC/GMT format; for example, 2009-08-24T05:38:48Z. No wildcards are allowed. 
 */
$buttonSearchRequest->StartDate = $_REQUEST['startDate'];
/*
 * (Optional) Ending date for the search. The value must be in UTC/GMT format; for example, 2010-05-01T05:38:48Z. No wildcards are allowed. 
 */
$buttonSearchRequest->EndDate = $_REQUEST['endDate'];
$buttonSearchReq = new BMButtonSearchReq();
$buttonSearchReq->BMButtonSearchRequest = $buttonSearchRequest;
/*
 * 	 ## 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 */
    $buttonSearchResponse = $paypalService->BMButtonSearch($buttonSearchReq);
} catch (Exception $ex) {
    require '../Error.php';
    exit;
}
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$buttonSearchResponse->Ack}</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($buttonSearchResponse);
echo "</pre>";
require_once '../Response.php';
require_once '../PPBootStrap.php';
/*
 * Use the BMGetButtonDetails API operation to obtain information about a hosted Website Payments Standard button. You can use this information to set the fields that have not changed when updating a button. 
 */
/*
 * (Required) The ID of the hosted button whose details you want to obtain.
 */
$bmGetButtonDetailsReqest = new BMGetButtonDetailsRequestType($_REQUEST['hostedID']);
$bmGetButtonDetailsReq = new BMGetButtonDetailsReq();
$bmGetButtonDetailsReq->BMGetButtonDetailsRequest = $bmGetButtonDetailsReqest;
/*
 * 	 ## 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 {
    $bmGetButtonDetailsResponse = $paypalService->BMGetButtonDetails($bmGetButtonDetailsReq);
} catch (Exception $ex) {
    require '../Error.php';
    exit;
}
echo "<table>";
echo "<tr><td>Ack :</td><td><div id='Ack'>{$bmGetButtonDetailsResponse->Ack}</div> </td></tr>";
echo "<tr><td>HostedButtonID :</td><td><div id='HostedButtonID'>" . $bmGetButtonDetailsResponse->HostedButtonID . "</div> </td></tr>";
echo "<tr><td>Email :</td><td><div id='Email'>" . $bmGetButtonDetailsResponse->Email . "</div> </td></tr>";
echo "</table>";
echo "<pre>";
print_r($bmGetButtonDetailsResponse);
echo "</pre>";
require_once '../Response.php';
Beispiel #28
0
/*
 *  Indicates whether to return all currencies. It is one of the
following values:

* 0 – Return only the balance for the primary currency holding.
* 1 – Return the balance for each currency holding.
*/
$getBalanceRequest->ReturnAllCurrencies = $_REQUEST['returnAllCurrencies'];
$getBalanceReq = new GetBalanceReq();
$getBalanceReq->GetBalanceRequest = $getBalanceRequest;
/*
 * 	 ## 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 */
    $getBalanceResponse = $paypalService->GetBalance($getBalanceReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($getBalanceResponse)) {
    echo "<table>";
    echo "<tr><td>Ack :</td><td><div id='Ack'>{$getBalanceResponse->Ack}</div> </td></tr>";
    echo "</table>";
    echo "<pre>";
    print_r($getBalanceResponse);
    echo "</pre>";
}
Beispiel #29
0
$MPPaymentDetails->Handling = new BasicAmountType($currencyId, $_REQUEST['handling']);
$MPPaymentDetails->Tax = new BasicAmountType($currencyId, $_REQUEST['tax']);
$MPPaymentDetails->PaymentType = $_REQUEST['paymentCodeType'];
$MPPaymentDetails->EmailSubject = $_REQUEST['mailSubject'];
$MPPaymentDetails->ItemName = $_REQUEST['itemName'];
$MPPaymentDetails->ItemNumber = $_REQUEST['itemNum'];
$MPPaymentDetails->Memo = $_REQUEST['memo'];
$MPPaymentDetails->MpID = $_REQUEST['billingAgreementID'];
$billUserReqest = new BillUserRequestType();
$billUserReqest->MerchantPullPaymentDetails = $MPPaymentDetails;
$billUserReq = new BillUserReq();
$billUserReq->BillUserRequest = $billUserReqest;
/*
 * 	 ## 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 */
    $billUserResponse = $paypalService->BillUser($billUserReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($billUserResponse)) {
    echo "<pre>";
    print_r($billUserResponse);
    echo "</pre>";
}
require_once '../Response.php';
$cardDetails->CreditCardType = $_POST['creditCardType'];
$cardDetails->ExpMonth = $_POST['expDateMonth'];
$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>";