Ejemplo n.º 1
0
 */
 $finalPaymentAmount = $res["AMT"];
 /*
 '------------------------------------
 ' Calls the DoExpressCheckoutPayment API call
 '
 ' The ConfirmPayment function is defined in the file PayPalFunctions.php,
 ' that is included at the top of this file.
 '-------------------------------------------------
 */
 //Format the  parameters that were stored or received from GetExperessCheckout call.
 $token = $_REQUEST['token'];
 $payerID = $_REQUEST['PayerID'];
 $paymentType = 'Sale';
 $currencyCodeType = $res['CURRENCYCODE'];
 $resArray = ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $finalPaymentAmount);
 $ack = strtoupper($resArray["ACK"]);
 if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
     /*
     * TODO: Proceed with desired action after the payment
     * (ex: start download, start streaming, Add coins to the game.. etc)
     '********************************************************************************************************************
     '
     ' THE PARTNER SHOULD SAVE THE KEY TRANSACTION RELATED INFORMATION LIKE
     '                    transactionId & orderTime
     '  IN THEIR OWN  DATABASE
     ' AND THE REST OF THE INFORMATION CAN BE USED TO UNDERSTAND THE STATUS OF THE PAYMENT
     '
     '********************************************************************************************************************
     */
     $transactionId = $resArray["PAYMENTINFO_0_TRANSACTIONID"];
 ' The paymentAmount is the total value of 
 ' the shopping cart, that was set 
 ' earlier in a session variable 
 ' by the shopping cart page
 '------------------------------------
 */
 $finalPaymentAmount = $_SESSION["Payment_Amount"];
 /*
 '------------------------------------
 ' Calls the DoExpressCheckoutPayment API call
 '
 ' The ConfirmPayment function is defined in the file PayPalFunctions.jsp,
 ' that is included at the top of this file.
 '-------------------------------------------------
 */
 $resArray = ConfirmPayment($finalPaymentAmount);
 $ack = strtoupper($resArray["ACK"]);
 if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
     /*
     '********************************************************************************************************************
     '
     ' THE PARTNER SHOULD SAVE THE KEY TRANSACTION RELATED INFORMATION LIKE 
     '                    transactionId & orderTime 
     '  IN THEIR OWN  DATABASE
     ' AND THE REST OF THE INFORMATION CAN BE USED TO UNDERSTAND THE STATUS OF THE PAYMENT 
     '
     '********************************************************************************************************************
     */
     $transactionId = $resArray["PAYMENTINFO_0_TRANSACTIONID"];
     // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
     $transactionType = $resArray["PAYMENTINFO_0_TRANSACTIONTYPE"];
Ejemplo n.º 3
0
 $_SESSION['DOPBSP_CheckOut'] = '';
 $_SESSION['DOPBSP_StartHour'] = '';
 $_SESSION['DOPBSP_EndHour'] = '';
 $_SESSION['DOPBSP_NoItems'] = '';
 $_SESSION['DOPBSP_Email'] = '';
 $_SESSION['DOPBSP_NoPeople'] = '';
 $_SESSION['DOPBSP_NoChildren'] = '';
 /*
 '------------------------------------
 ' Calls the DoExpressCheckoutPayment API call
 '
 ' The ConfirmPayment function is defined in the file PayPalFunctions.jsp,
 ' that is included at the top of this file.
 '-------------------------------------------------
 */
 $resArray = ConfirmPayment($finalPaymentAmount_holder);
 $ack = strtoupper($resArray["ACK"]);
 if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
     /*
     '********************************************************************************************************************
     '
     ' THE PARTNER SHOULD SAVE THE KEY TRANSACTION RELATED INFORMATION LIKE 
     '                    transactionId & orderTime 
     '  IN THEIR OWN  DATABASE
     ' AND THE REST OF THE INFORMATION CAN BE USED TO UNDERSTAND THE STATUS OF THE PAYMENT 
     '
     '********************************************************************************************************************
     */
     $transactionId = $resArray["PAYMENTINFO_0_TRANSACTIONID"];
     // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
     //            $transactionType = $resArray["PAYMENTINFO_0_TRANSACTIONTYPE"]; //' The type of transaction Possible values: l  cart l  express-checkout
Ejemplo n.º 4
0
$paypalUsername = $paypalParams['username'];
$paypalPassword = $paypalParams['password'];
$paypalSignature = $paypalParams['signature'];
require_once "paypalfunctions.php";
$form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
$form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
$form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
if ($form->validate()) {
    $formValues = $form->getSubmitValues();
    if (isset($formValues['cancel'])) {
        $plugin->cancelSale($sale['id']);
        unset($_SESSION['bc_sale_id']);
        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php');
        exit;
    }
    $confirmPayments = ConfirmPayment($sale['price']);
    if ($confirmPayments['ACK'] !== 'Success') {
        $erroMessage = vsprintf($plugin->get_lang('ErrorOccurred'), [$expressCheckout['L_ERRORCODE0'], $confirmPayments['L_LONGMESSAGE0']]);
        Display::addFlash(Display::return_message($erroMessage, 'error', false));
        header('Location: ../index.php');
        exit;
    }
    $transactionId = $confirmPayments["PAYMENTINFO_0_TRANSACTIONID"];
    $transactionType = $confirmPayments["PAYMENTINFO_0_TRANSACTIONTYPE"];
    switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
        case 'Completed':
            $saleIsCompleted = $plugin->completeSale($sale['id']);
            if ($saleIsCompleted && $buyingSession) {
                Display::addFlash(Display::return_message(sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $session['name']), 'success'));
                $plugin->storePayouts($sale['id']);
                break;
Ejemplo n.º 5
0
if (!USERACTION_FLAG && !isset($_SESSION['EXPRESS_MARK'])) {
    if (isset($_POST['shipping_method'])) {
        $new_shipping = $_POST['shipping_method'];
    }
    //need to change this value, just for testing
    if ($shippingAmt > 0) {
        $finalPaymentAmount = $totalAmt + $new_shipping - $_SESSION['shippingAmt'];
        $_SESSION['shippingAmt'] = $new_shipping;
    }
}
/* Review block end */
/*
 * Calls the DoExpressCheckoutPayment API call
 */
//$resArrayDoExpressCheckout = ConfirmPayment ( $newTotalAmt );
$resArrayDoExpressCheckout = ConfirmPayment($finalPaymentAmount);
$ackDoExpressCheckout = strtoupper($resArrayDoExpressCheckout["ACK"]);
include 'header.php';
session_unset();
// free all session variables
session_destroy();
//destroy session
if ($ackDoExpressCheckout == "SUCCESS" || $ackDoExpressCheckout == "SUCCESSWITHWARNING") {
    $transactionId = $resArrayDoExpressCheckout["PAYMENTINFO_0_TRANSACTIONID"];
    // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
    $transactionType = $resArrayDoExpressCheckout["PAYMENTINFO_0_TRANSACTIONTYPE"];
    //' The type of transaction Possible values: l  cart l  express-checkout
    $paymentType = $resArrayDoExpressCheckout["PAYMENTINFO_0_PAYMENTTYPE"];
    //' Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant
    $orderTime = $resArrayDoExpressCheckout["PAYMENTINFO_0_ORDERTIME"];
    //' Time/date stamp of payment
Ejemplo n.º 6
0
    // Set by newpayment.php
    $paymentType        = $_SESSION['PaymentType'];
    $currencyCodeType   = $_SESSION['currencyCodeType'];
    $FinalPaymentAmt    = $_SESSION["Payment_Amount"];
    // From env
    $ipaddress          = $_SESSION['ipaddress'];


    if (! empty($paymentType))
    {
        dol_syslog("We call GetExpressCheckoutDetails");
        $resArray=GetDetails($token);
        //var_dump($resarray);

        dol_syslog("We call DoExpressCheckoutPayment token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag);
        $resArray=ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);

        $ack = strtoupper($resArray["ACK"]);
        if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
        {
        	$object = (object) 'paypal';
        	
        	$object->source		= $source;
        	$object->ref		= $ref;
        	$object->payerID	= $payerID;
        	$object->fulltag	= $fulltag;
        	$object->resArray	= $resArray;

            // resArray was built from a string like that
            // TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
            $PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]);   // Should contains 'Completed'
Ejemplo n.º 7
0
function mx_orderconfirmation($cart)
{
    /*==================================================================
    		 PayPal Express Checkout Call
    		 ===================================================================
    		*/
    if ($cart->paymentoption == "PayPal") {
        /*
        '------------------------------------
        ' The paymentAmount is the total value of
        ' the shopping cart, that was set
        ' earlier in a session variable
        ' by the shopping cart page
        '------------------------------------
        */
        $finalPaymentAmount = $cart->total + $cart->taxes;
        /*
        '------------------------------------
        ' Calls the DoExpressCheckoutPayment API call
        '
        ' The ConfirmPayment function is defined in the file PayPalFunctions.jsp,
        ' that is included at the top of this file.
        '-------------------------------------------------
        */
        $resArray = ConfirmPayment($cart);
        $ack = strtoupper($resArray["ACK"]);
        if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
            /*
            '********************************************************************************************************************
            '
            ' THE PARTNER SHOULD SAVE THE KEY TRANSACTION RELATED INFORMATION LIKE
            '                    transactionId & orderTime
            '  IN THEIR OWN  DATABASE
            ' AND THE REST OF THE INFORMATION CAN BE USED TO UNDERSTAND THE STATUS OF THE PAYMENT
            '
            '********************************************************************************************************************
            */
            $transactionId = $resArray["TRANSACTIONID"];
            // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
            $transactionType = $resArray["TRANSACTIONTYPE"];
            //' The type of transaction Possible values: l  cart l  express-checkout
            $paymentType = $resArray["PAYMENTTYPE"];
            //' Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant
            $orderTime = $resArray["ORDERTIME"];
            //' Time/date stamp of payment
            $amt = $resArray["AMT"];
            //' The final amount charged, including any shipping and taxes from your Merchant Profile.
            $currencyCode = $resArray["CURRENCYCODE"];
            //' A three-character currency code for one of the currencies listed in PayPay-Supported Transactional Currencies. Default: USD.
            $feeAmt = $resArray["FEEAMT"];
            //' PayPal fee amount charged for the transaction
            $settleAmt = $resArray["SETTLEAMT"];
            //' Amount deposited in your PayPal account after a currency conversion.
            $taxAmt = $resArray["TAXAMT"];
            //' Tax charged on the transaction.
            $exchangeRate = $resArray["EXCHANGERATE"];
            //' Exchange rate if a currency conversion occurred. Relevant only if your are billing in their non-primary currency. If the customer chooses to pay with a currency other than the non-primary currency, the conversion occurs in the customer�s account.
            /*
            ' Status of the payment:
            		'Completed: The payment has been completed, and the funds have been added successfully to your account balance.
            		'Pending: The payment is pending. See the PendingReason element for more information.
            */
            $paymentStatus = $resArray["PAYMENTSTATUS"];
            /*
            'The reason the payment is pending:
            '  none: No pending reason
            '  address: The payment is pending because your customer did not include a confirmed shipping address and your Payment Receiving Preferences is set such that you want to manually accept or deny each of these payments. To change your preference, go to the Preferences section of your Profile.
            '  echeck: The payment is pending because it was made by an eCheck that has not yet cleared.
            '  intl: The payment is pending because you hold a non-U.S. account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview.
            '  multi-currency: You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment.
            '  verify: The payment is pending because you are not yet verified. You must verify your account before you can accept this payment.
            '  other: The payment is pending for a reason other than those listed above. For more information, contact PayPal customer service.
            */
            $pendingReason = $resArray["PENDINGREASON"];
            /*
            'The reason for a reversal if TransactionType is reversal:
            '  none: No reason code
            '  chargeback: A reversal has occurred on this transaction due to a chargeback by your customer.
            '  guarantee: A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.
            '  buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer.
            '  refund: A reversal has occurred on this transaction because you have given the customer a refund.
            '  other: A reversal has occurred on this transaction due to a reason not listed above.
            */
            $reasonCode = $resArray["REASONCODE"];
        } else {
            //Display a user friendly Error on the page using any of the following error information returned by PayPal
            $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
            $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
            $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
            $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
            //echo "DoExpressCheckout API call failed. ";
            //echo "Detailed Error Message: " . $ErrorLongMsg;
            //echo "Short Error Message: " . $ErrorShortMsg;
            //echo "Error Code: " . $ErrorCode;
            //echo "Error Severity Code: " . $ErrorSeverityCode;
        }
    }
    return $resArray;
}
}
//var_dump("<pre>", $signup_cart); die('x');
///////////////////////////////////////////////////////////////////
#/ Process POst data from Step 1
if (isset($user_POST['vercode'])) {
    //$fv_errors = array();
    //if(!is_array($fv_errors) || empty($fv_errors) || (count($fv_errors)<=0))
    //{
    ##/ Process Checkout confirmation with Paypal
    set_time_limit(0);
    require_once "../includes/paypal/classic/express/paypalfunctions.php";
    $net_total = @$signup_cart['paymentAmount'];
    $_SESSION['Payment_Amount'] = $net_total;
    $resArray = array();
    $ack = $msgx = '';
    $resArray = ConfirmPayment($net_total);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $transactionId = @$resArray["PAYMENTINFO_0_TRANSACTIONID"];
        // ' Unique transaction ID of the payment. Note:  If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs.
        $transactionType = @$resArray["PAYMENTINFO_0_TRANSACTIONTYPE"];
        //' The type of transaction Possible values: l  cart l  express-checkout
        $paymentType = @$resArray["PAYMENTINFO_0_PAYMENTTYPE"];
        //' Indicates whether the payment is instant or delayed. Possible values: l  none l  echeck l  instant
        $orderTime = @$resArray["PAYMENTINFO_0_ORDERTIME"];
        //' Time/date stamp of payment
        $amt = @$resArray["PAYMENTINFO_0_AMT"];
        //' The final amount charged, including any shipping and taxes from your Merchant Profile.
        $currencyCode = @$resArray["PAYMENTINFO_0_CURRENCYCODE"];
        //' A three-character currency code for one of the currencies listed in PayPay-Supported Transactional Currencies. Default: USD.
        $feeAmt = @$resArray["PAYMENTINFO_0_FEEAMT"];