function get_request_url($order_id) { $user = learn_press_get_current_user(); $nonce = wp_create_nonce('learn-press-paypal-nonce'); $order = LP_Order::instance($order_id); $custom = array('order_id' => $order_id, 'order_key' => $order->order_key); $query = array('cmd' => '_xclick', 'amount' => learn_press_get_cart_total(), 'quantity' => '1', 'business' => $this->paypal_email, 'item_name' => learn_press_get_cart_description(), 'return' => add_query_arg(array('learn-press-transaction-method' => 'paypal-standard', 'paypal-nonce' => $nonce), learn_press_get_cart_course_url()), 'currency_code' => learn_press_get_currency(), 'notify_url' => get_site_url() . '/?' . learn_press_get_web_hook('paypal-standard') . '=1', 'no_note' => '1', 'shipping' => '0', 'email' => $user->user_email, 'rm' => '2', 'cancel_return' => learn_press_get_cart_course_url(), 'custom' => json_encode($custom), 'no_shipping' => '1'); $query = apply_filters('learn_press_paypal_standard_query', $query); $paypal_payment_url = $this->paypal_url . '?' . http_build_query($query); return $paypal_payment_url; }
function get_paypal_basic_request_url($order) { $settings = get_option('_lpr_settings_payment'); if (empty($settings['paypal'])) { return; } $paypal_settings = $settings['paypal']; $user = learn_press_get_current_user(); $paypal_args = array('cmd' => '_xclick', 'amount' => learn_press_get_cart_total(), 'quantity' => '1'); $transaction = learn_press_generate_transaction_object(); $temp_id = learn_press_uniqid(); $xxx = @file_get_contents(LPR_PLUGIN_PATH . '/temp.txt'); learn_press_set_transient_transaction('lpps', $temp_id, $user->ID, $transaction); file_put_contents(LPR_PLUGIN_PATH . '/temp.txt', $xxx . "=" . $temp_id); /*$order_id = LearnPress()->session->get( 'learn_press_user_order' ); $order_id = learn_press_add_transaction( array( 'method' => $this->method, 'method_id' => '', 'status' => '', 'user_id' => null, 'order_id' => $order_id, 'parent' => 0, 'transaction_object' => $transaction ) ); //LearnPress()->session->set( 'learn_press_user_order', $order_id ); $order = new LPR_Order( $order_id );*/ $nonce = wp_create_nonce('learn-press-paypal-nonce'); $paypal_email = $paypal_settings['sandbox'] ? $paypal_settings['paypal_sandbox_email'] : $paypal_settings['paypal_email']; $query = array('business' => $paypal_email, 'item_name' => learn_press_get_cart_description(), 'return' => add_query_arg(array('learn-press-transaction-method' => 'paypal-standard', 'paypal-nonce' => $nonce), learn_press_get_cart_course_url()), 'currency_code' => learn_press_get_currency(), 'notify_url' => get_site_url() . '/?' . learn_press_get_web_hook('paypal-standard') . '=1', 'no_note' => '1', 'shipping' => '0', 'email' => $user->user_email, 'rm' => '2', 'cancel_return' => learn_press_get_cart_course_url(), 'custom' => $temp_id, 'no_shipping' => '1'); $query = array_merge($paypal_args, $query); $query = apply_filters('it_exchange_paypal_standard_query', $query); $paypal_payment_url = ($paypal_settings['sandbox'] ? $this->paypal_payment_sandbox_url : $this->paypal_payment_live_url) . '?' . http_build_query($query); return $paypal_payment_url; }