当前位置: 首页>>代码示例>>PHP>>正文


PHP RedirectToPayPal函数代码示例

本文整理汇总了PHP中RedirectToPayPal函数的典型用法代码示例。如果您正苦于以下问题:PHP RedirectToPayPal函数的具体用法?PHP RedirectToPayPal怎么用?PHP RedirectToPayPal使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RedirectToPayPal函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: express_checkout

 function express_checkout($paymenAmount)
 {
     $resArray = CallShortcutExpressCheckout($paymenAmount, $this->currencyCodeType, $this->paymentType, $this->returnURL, $this->cancelURL);
     $ack = strtoupper($resArray["ACK"]);
     if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
         RedirectToPayPal($resArray["TOKEN"]);
     } else {
         $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
         $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
         $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
         $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
         echo "SetExpressCheckout API call failed. ";
         echo "Detailed Error Message: " . $ErrorLongMsg;
         echo "Short Error Message: " . $ErrorShortMsg;
         echo "Error Code: " . $ErrorCode;
         echo "Error Severity Code: " . $ErrorSeverityCode;
     }
 }
开发者ID:adadsa,项目名称:sosmed,代码行数:18,代码来源:paypal_helper.php

示例2: CallMarkExpressCheckout

    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $cancelURL = "http://127.0.0.1/project/checkout/index2.php";
    //'------------------------------------
    //' Calls the SetExpressCheckout API call
    //'
    //' The CallMarkExpressCheckout function is defined in the file PayPalFunctions.php,
    //' it is included at the top of this file.
    //'-------------------------------------------------
    $resArray = CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $token = urldecode($resArray["TOKEN"]);
        $_SESSION['reshash'] = $token;
        RedirectToPayPal($token);
    } 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 "SetExpressCheckout API call failed. ";
        echo "Detailed Error Message: " . $ErrorLongMsg;
        echo "Short Error Message: " . $ErrorShortMsg;
        echo "Error Code: " . $ErrorCode;
        echo "Error Severity Code: " . $ErrorSeverityCode;
    }
} else {
    if (($PaymentOption == "Visa" || $PaymentOption == "MasterCard" || $PaymentOption == "Amex" || $PaymentOption == "Discover") && $PaymentProcessorSelected == "PayPal Direct Payment") {
        //'------------------------------------
开发者ID:Keminda3098,项目名称:Devins,代码行数:31,代码来源:billing.php

示例3: CallShortcutExpressCheckout

//' The cancelURL is the location buyers are sent to when they hit the
//' cancel button during authorization of payment during the PayPal flow
//'
//' This is set to the value entered on the Integration Assistant
//'------------------------------------
$cancelURL = $_SESSION[$guid]["absoluteURL"] . "/" . $_GET["fail"];
//'------------------------------------
//' Calls the SetExpressCheckout API call
//'
//' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
//' it is included at the top of this file.
//'-------------------------------------------------
$resArray = CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, urlencode($returnURL), urlencode($cancelURL), $guid);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
    RedirectToPayPal($resArray["TOKEN"]);
} 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"]);
    if ($ErrorLongMsg = "Currency is not supported") {
        $URL = $_SESSION[$guid]["gatewayCurrencyNoSupportReturnURL"];
        header("Location: {$URL}");
    } else {
        echo "SetExpressCheckout API call failed. ";
        echo "Detailed Error Message: " . $ErrorLongMsg;
        echo "Short Error Message: " . $ErrorShortMsg;
        echo "Error Code: " . $ErrorCode;
        echo "Error Severity Code: " . $ErrorSeverityCode;
开发者ID:actcattest001,项目名称:core,代码行数:31,代码来源:expresscheckout.php

示例4: CallShortcutExpressCheckout

     $paypalUsername = $paypalParams['username'];
     $paypalPassword = $paypalParams['password'];
     $paypalSignature = $paypalParams['signature'];
     require_once "paypalfunctions.php";
     $i = 0;
     $extra = "&L_PAYMENTREQUEST_0_NAME0={$sale['product_name']}";
     $extra .= "&L_PAYMENTREQUEST_0_AMT0={$sale['price']}";
     $extra .= "&L_PAYMENTREQUEST_0_QTY0=1";
     $expressCheckout = CallShortcutExpressCheckout($sale['price'], $currency['iso_code'], 'paypal', api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/success.php', api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/error.php', $extra);
     if ($expressCheckout["ACK"] !== 'Success') {
         $erroMessage = vsprintf($plugin->get_lang('ErrorOccurred'), [$expressCheckout['L_ERRORCODE0'], $expressCheckout['L_LONGMESSAGE0']]);
         Display::addFlash(Display::return_message($erroMessage, 'error', false));
         header('Location: ../index.php');
         exit;
     }
     RedirectToPayPal($expressCheckout["TOKEN"]);
     break;
 case BuyCoursesPlugin::PAYMENT_TYPE_TRANSFER:
     $buyingCourse = false;
     $buyingSession = false;
     switch ($sale['product_type']) {
         case BuyCoursesPlugin::PRODUCT_TYPE_COURSE:
             $buyingCourse = true;
             $course = $plugin->getCourseInfo($sale['product_id']);
             break;
         case BuyCoursesPlugin::PRODUCT_TYPE_SESSION:
             $buyingSession = true;
             $session = $plugin->getSessionInfo($sale['product_id']);
             break;
     }
     $transferAccounts = $plugin->getTransferAccounts();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:process_confirm.php

示例5: sendStockreordermail

                sendStockreordermail($product_option_id, $quantity);
            }
        }
        // end while
    }
    // end number of rows
    // Settle seller , Admin Amounts
    // End
    $payment_completed = true;
}
// End
if ($ack == "SUCCESS" && $payment_completed) {
    if ("" == $preapprovalKey) {
        // redirect for web approval flow
        $cmd = "cmd=_ap-payment&paykey=" . urldecode($resArray["payKey"]);
        RedirectToPayPal($cmd);
    } else {
        // payKey is the key that you can use to identify the result from this Pay call
        $payKey = urldecode($resArray["payKey"]);
        // paymentExecStatus is the status of the payment
        $paymentExecStatus = urldecode($resArray["paymentExecStatus"]);
    }
} else {
    //Display a user friendly Error on the page using any of the following error information returned by PayPal
    //TODO - There can be more than 1 error, so check for "error(1).errorId", then "error(2).errorId", and so on until you find no more errors.
    $ErrorCode = urldecode($resArray["error(0).errorId"]);
    $ErrorMsg = urldecode($resArray["error(0).message"]);
    $ErrorDomain = urldecode($resArray["error(0).domain"]);
    $ErrorSeverity = urldecode($resArray["error(0).severity"]);
    $ErrorCategory = urldecode($resArray["error(0).category"]);
    $message .= $ErrorMsg;
开发者ID:kevinsmasters,项目名称:purecatskillsmarketplace,代码行数:31,代码来源:paypal-parallel-payment_1.php

示例6: gateway_paypal_certified

function gateway_paypal_certified($seperator, $sessionid)
{
    $_SESSION['paypalExpressMessage'] = '	<h4>Transaction Canceled</h4>';
    // ==================================
    // PayPal Express Checkout Module
    // ==================================
    //'------------------------------------
    //' The paymentAmount is the total value of
    //' the shopping cart, that was set
    //' earlier in a session variable
    //' by the shopping cart page
    //'------------------------------------
    //exit('<pre>'.print_r($_SESSION, true).'</pre>');
    $paymentAmount = wpsc_cart_total(false);
    $_SESSION['paypalAmount'] = $paymentAmount;
    $_SESSION['paypalexpresssessionid'] = $sessionid;
    paypal_certified_currencyconverter();
    //exit($_SESSION['paypalAmount']);
    //'------------------------------------
    //' The currencyCodeType and paymentType
    //' are set to the selections made on the Integration Assistant
    //'------------------------------------
    $currencyCodeType = get_option('paypal_curcode');
    $paymentType = "Sale";
    //'------------------------------------
    //' The returnURL is the location where buyers return to when a
    //' payment has been succesfully authorized.
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    //exit(get_option('transact_url'));
    $transact_url = get_option('transact_url');
    $returnURL = $transact_url . $seperator . "sessionid=" . $sessionid . "&gateway=paypal";
    //'------------------------------------
    //' The cancelURL is the location buyers are sent to when they hit the
    //' cancel button during authorization of payment during the PayPal flow
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $cancelURL = $transact_url;
    //'------------------------------------
    //' Calls the SetExpressCheckout API call
    //'
    //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
    //' it is included at the top of this file.
    //'-------------------------------------------------
    $resArray = CallShortcutExpressCheckout($_SESSION['paypalAmount'], $currencyCodeType, $paymentType, $returnURL, $cancelURL);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS") {
        RedirectToPayPal($resArray["TOKEN"]);
    } 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 "SetExpressCheckout API call failed. ";
        echo "Detailed Error Message: " . $ErrorLongMsg;
        echo "Short Error Message: " . $ErrorShortMsg;
        echo "Error Code: " . $ErrorCode;
        echo "Error Severity Code: " . $ErrorSeverityCode;
    }
    // header("Location: ".get_option('paypal_multiple_url')."?".$output);
    exit;
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:65,代码来源:paypal_certified.php

示例7: CallShortcutExpressCheckout

$returnURL = 'add return URL';
//'------------------------------------
//' The cancelURL is the location buyers are sent to when they hit the
//' cancel button during authorization of payment during the PayPal flow
//'
//' This is set to the value entered on the Integration Assistant
//'------------------------------------
$cancelURL = 'add cancel URL';
//'------------------------------------
//' Calls the SetExpressCheckout API call
//'
//' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
//' it is included at the top of this file.
//'-------------------------------------------------
$resArray = CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $planSelect, $planPrice, $planNumberSelect);
$ack = strtoupper($resArray['ACK']);
if ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING') {
    RedirectToPayPal($resArray['TOKEN']);
} 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 'SetExpressCheckout API call failed. ';
    echo 'Detailed Error Message: ' . $ErrorLongMsg;
    echo 'Short Error Message: ' . $ErrorShortMsg;
    echo 'Error Code: ' . $ErrorCode;
    echo 'Error Severity Code: ' . $ErrorSeverityCode;
    var_dump($nvpstr);
}
开发者ID:kojiyamauchi,项目名称:WebPayAndPayPalAPISampleInWordPress,代码行数:31,代码来源:expresscheckout.php

示例8: display

    function display($tmpl = null)
    {
        global $_js_helper;
        $headers = array('Content-Type: text/html; charset=UTF-8', "From: JOBSSHOP <admin@gmail.com>");
        if (JS_Helper::get_input('snap_task') == 'make-payment') {
            $tmpl = 'register.jobsboss-make-payment';
        }
        if ('POST' == $_SERVER['REQUEST_METHOD']) {
            $redirect_to = site_url();
            if (JS_Helper::get_input('snap_task') == 'make-payment') {
                $returnURL = RETURN_URL;
                $cancelURL = CANCEL_URL;
                $resArray = CallShortcutExpressCheckout($_POST, $returnURL, $cancelURL);
                $ack = strtoupper($resArray["ACK"]);
                if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
                    RedirectToPayPal($resArray["TOKEN"]);
                } 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 "SetExpressCheckout API call failed. ";
                    echo "Detailed Error Message: " . $ErrorLongMsg;
                    echo "Short Error Message: " . $ErrorShortMsg;
                    echo "Error Code: " . $ErrorCode;
                    echo "Error Severity Code: " . $ErrorSeverityCode;
                }
            }
            $userdata = $_POST['_snap_data'];
            $userdata['role'] = $this->user_role;
            $userdata['user_login'] = sanitize_title($userdata['user_login']);
            $errors = wp_insert_user($userdata);
            $this->message = '';
            if (!is_wp_error($errors)) {
                $meta = $userdata['meta'];
                $meta_success = 0;
                foreach ($meta as $meta_key => $meta_value) {
                    $meta_success += update_user_meta($errors, $meta_key, $meta_value) ? 1 : 0;
                }
                if ($meta_success > 0) {
                    $user_email = $userdata['user_email'];
                    $email_subject = "Account Details for {$userdata['first_name']} at Jobs Shop";
                    $site_url = site_url();
                    $email_content = <<<EOB
Hello {$userdata['first_name']},<br />
<br />
Thank you for registering at Jobs Shop.<br />
<br />
You may now log in to {$site_url} using the following username and password:<br />
<br />
Username: {$userdata['user_login']}<br />
Password: {$userdata['user_pass']}
EOB;
                    $headers = array('Content-Type: text/html; charset=UTF-8', "From: JOBSSHOP <admin@gmail.com>");
                    wp_mail($user_email, $email_subject, $email_content, $headers);
                    $action = isset($_POST['action']);
                    if ($action) {
                        $redirect_to = site_url('jobsboss/register/make-payment');
                        $redirect_to = add_query_arg(array('uid' => $errors), $redirect_to);
                    }
                    wp_redirect($redirect_to);
                    exit;
                }
            } else {
                $this->message = $errors->errors;
            }
            $this->userdata = $userdata;
        }
        $this->assignRef('user_role', $this->user_role);
        parent::display($tmpl, true);
    }
开发者ID:quangnpd,项目名称:jobshop_web,代码行数:72,代码来源:register.php

示例9: mx_billing

function mx_billing($cart)
{
    if ($PaymentOption == "PayPal") {
        // ==================================
        // PayPal Express Checkout Module
        // ==================================
        //'------------------------------------
        //' The paymentAmount is the total value of
        //' the shopping cart, that was set
        //' earlier in a session variable
        //' by the shopping cart page
        //'------------------------------------
        $paymentAmount = $_SESSION["Payment_Amount"];
        //'------------------------------------
        //' When you integrate this code
        //' set the variables below with
        //' shipping address details
        //' entered by the user on the
        //' Shipping page.
        //'------------------------------------
        $shipToName = "<<ShiptoName>>";
        $shipToStreet = "<<ShipToStreet>>";
        $shipToStreet2 = "<<ShipToStreet2>>";
        //Leave it blank if there is no value
        $shipToCity = "<<ShipToCity>>";
        $shipToState = "<<ShipToState>>";
        $shipToCountryCode = "<<ShipToCountryCode>>";
        // Please refer to the PayPal country codes in the API documentation
        $shipToZip = "<<ShipToZip>>";
        $phoneNum = "<<PhoneNumber>>";
        //'------------------------------------
        //' The currencyCodeType and paymentType
        //' are set to the selections made on the Integration Assistant
        //'------------------------------------
        $currencyCodeType = "USD";
        $paymentType = "Sale";
        //'------------------------------------
        //' The returnURL is the location where buyers return to when a
        //' payment has been succesfully authorized.
        //'
        //' This is set to the value entered on the Integration Assistant
        //'------------------------------------
        $returnURL = "http://www.example.com/pp/gateway.php";
        //'------------------------------------
        //' The cancelURL is the location buyers are sent to when they hit the
        //' cancel button during authorization of payment during the PayPal flow
        //'
        //' This is set to the value entered on the Integration Assistant
        //'------------------------------------
        $cancelURL = "http://www.example.com/pp/gateway.php";
        //'------------------------------------
        //' Calls the SetExpressCheckout API call
        //'
        //' The CallMarkExpressCheckout function is defined in the file PayPalFunctions.php,
        //' it is included at the top of this file.
        //'-------------------------------------------------
        $resArray = CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum);
        $ack = strtoupper($resArray["ACK"]);
        if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
            $token = urldecode($resArray["TOKEN"]);
            $_SESSION['reshash'] = $token;
            RedirectToPayPal($token);
        } 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 "SetExpressCheckout API call failed. ";
            echo "Detailed Error Message: " . $ErrorLongMsg;
            echo "Short Error Message: " . $ErrorShortMsg;
            echo "Error Code: " . $ErrorCode;
            echo "Error Severity Code: " . $ErrorSeverityCode;
        }
    } else {
        if (($PaymentOption == "Visa" || $PaymentOption == "MasterCard" || $PaymentOption == "Amex" || $PaymentOption == "Discover") && $PaymentProcessorSelected == "PayPal Direct Payment") {
            //'------------------------------------
            //' The paymentAmount is the total value of
            //' the shopping cart, that was set
            //' earlier in a session variable
            //' by the shopping cart page
            //'------------------------------------
            $paymentAmount = $_SESSION["Payment_Amount"];
        }
        //'------------------------------------
        //' The currencyCodeType and paymentType
        //' are set to the selections made on the Integration Assistant
        //'------------------------------------
        $currencyCodeType = "USD";
        $paymentType = "Sale";
        //' Set these values based on what was selected by the user on the Billing page Html form
        $creditCardType = "<<Visa/MasterCard/Amex/Discover>>";
        //' Set this to one of the acceptable values (Visa/MasterCard/Amex/Discover) match it to what was selected on your Billing page
        $creditCardNumber = "<<CC number>>";
        //' Set this to the string entered as the credit card number on the Billing page
        $expDate = "<<Expiry Date>>";
        //' Set this to the credit card expiry date entered on the Billing page
        $cvv2 = "<<cvv2>>";
        //' Set this to the CVV2 string entered on the Billing page
        $firstName = "<<firstName>>";
//.........这里部分代码省略.........
开发者ID:nsystem1,项目名称:OS-MusXpand,代码行数:101,代码来源:mx_paypal.php


注:本文中的RedirectToPayPal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。