コード例 #1
0
function paypal_hash_call($methodName, $nvpStr)
{
    //declaring of variables
    $version = 71;
    if ('sandbox' == get_option('paypal_certified_server_type')) {
        $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
        $paypal_certified_url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=";
    } else {
        $API_Endpoint = "https://api-3t.paypal.com/nvp";
        $paypal_certified_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=";
    }
    $USE_PROXY = false;
    $API_UserName = get_option('paypal_certified_apiuser');
    $API_Password = get_option('paypal_certified_apipass');
    $API_Signature = get_option('paypal_certified_apisign');
    $sBNCode = "PP-ECWizard";
    //NVPRequest for submitting to server
    $nvpreq = "METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER="******"&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
    // Configure WP_HTTP
    if ($USE_PROXY) {
        if (!defined('WP_PROXY_HOST') && !defined('WP_PROXY_PORT')) {
            define('WP_PROXY_HOST', $PROXY_HOST);
            define('WP_PROXY_PORT', $PROXY_PORT);
        }
    }
    add_filter('https_ssl_verify', '__return_false');
    $options = array('timeout' => 20, 'body' => $nvpreq, 'httpversion' => '1.1', 'sslverify' => false);
    $nvpReqArray = paypal_deformatNVP($nvpreq);
    wpsc_update_customer_meta('paypal_express_nvp_req_array', $nvpReqArray);
    $res = wp_remote_post($API_Endpoint, $options);
    if (is_wp_error($res)) {
        wpsc_update_customer_meta('paypal_express_curl_error_msg', 'WP HTTP Error: ' . $res->get_error_message());
        $nvpResArray = paypal_deformatNVP('');
    } else {
        $nvpResArray = paypal_deformatNVP($res['body']);
    }
    return $nvpResArray;
}
コード例 #2
0
function paypal_update_log($paypal_log_id, $response)
{
    global $db;
    $nvpResArray = paypal_deformatNVP($response);
    $query = "update " . TABLE_PAYPAL_LOG . " set response='" . zen_db_input($response) . "',ack='" . zen_db_input($nvpResArray['ACK']) . "',updated=now() where paypal_log_id=" . (int) $paypal_log_id;
    $db->Execute($query);
}