本文整理汇总了PHP中WC_Order::get_checkout_payment_url方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_checkout_payment_url方法的具体用法?PHP WC_Order::get_checkout_payment_url怎么用?PHP WC_Order::get_checkout_payment_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Order
的用法示例。
在下文中一共展示了WC_Order::get_checkout_payment_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Process the payment field and redirect to checkout/pay page.
*
* @param $order_id
* @return array
*/
function process_payment($order_id)
{
$order = new WC_Order($order_id);
// Persist the payment method, bank name and emi months as private custom fields.
update_post_meta($order->id, '_pz_payment_method', mysql_real_escape_string($_POST['pz_payment_method']));
//update_post_meta($order->id, '_pz_bank_name', mysql_real_escape_string($_POST['pz_bank_name']));
//update_post_meta($order->id, '_pz_emi_months', mysql_real_escape_string($_POST['pz_emi_months']));
// Redirect to checkout/pay page
return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, $order->get_checkout_payment_url(true))));
}
示例2: array
/**
* Process the payment and check if the currency is in PHP
*/
function process_payment($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
$woocommerce->cart->empty_cart();
if (get_woocommerce_currency() == 'PHP' || get_woocommerce_currency() == 'php') {
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
} else {
$woocommerce->add_error(__('Currency Error: ', 'woothemes') . "will only accept PHP currency.");
}
}
示例3: array
/**
*
* @global type $woocommerce
* @param type $order_id
* @return type
*
* Esta funcion se ejecuta junto luego de seleccionar el metodo de pago.
*
*/
function process_payment($order_id)
{
global $woocommerce;
$order = new \WC_Order($order_id);
$installments = $this->checkInstallments($_POST["cuotasMP"]);
/*
* Se agrega el meta dato de cuotas.
* Si ya existe se actualiza
*/
if (!add_post_meta($order_id, "CUOTASMP", $installments, true)) {
update_post_meta($order_id, "CUOTASMP", $installments);
}
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
}
示例4: process_payment
public function process_payment($order_id)
{
if (!$this->is_currency_supported()) {
throw new Exception(__('You cannot use this currency with LINE Pay.', 'wc-payment-gateway-line-pay'));
}
$order = new WC_Order($order_id);
$items = $order->get_items();
reset($items);
$first_item = $items[key($items)];
$item_name = $first_item['name'];
$item_count = $order->get_item_count();
$product_name = $item_name;
if ($item_count > 1) {
$product_name .= sprintf(__(' and %s others', 'wc-payment-gateway-line-pay'), $item_count - 1);
}
$response_data = $this->client->reserve($product_name, $this->product_image_url, $order->get_total(), get_woocommerce_currency(), add_query_arg('wc-api', 'linepay_confirm_url', home_url('/')), $order->get_checkout_payment_url(), $order_id, $this->get_option('langCd'));
if ($response_data->returnCode != '0000') {
throw new Exception(sprintf(__('Incorrect parameters were passed during checkout. Please contact site administrator. Return code: %s', 'wc-payment-gateway-line-pay'), $response_data->returnCode));
}
update_post_meta($order_id, '_hpd_linepay_transactionId', $response_data->info->transactionId);
WC()->cart->empty_cart();
return array('result' => 'success', 'redirect' => $response_data->info->paymentUrl->web);
}
示例5: array
/**
* Process the payment and return the result
**/
function process_payment($order_id)
{
$order = new WC_Order($order_id);
if (version_compare(WOOCOMMERCE_VERSION, '2.1.0', '>=')) {
/* 2.1.0 */
$checkout_payment_url = $order->get_checkout_payment_url(true);
} else {
/* 2.0.0 */
$checkout_payment_url = get_permalink(get_option('woocommerce_pay_page_id'));
}
return array('result' => 'success', 'redirect' => add_query_arg('order_pay', $order->id, $checkout_payment_url));
}
示例6: printf
function thankyou_page()
{
global $woocommerce;
if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
/* WC 2.1 */
global $wp;
$order_id = (int) $wp->query_vars['order-received'];
} else {
$order_id = (int) $_GET['order'];
}
$order = new WC_Order($order_id);
if ($order->status == 'processing' || $order->status == 'completed') {
if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
/* WC 2.1 */
$url_commande = $order->get_view_order_url();
$montant_commande = wc_price($order->order_total);
} else {
$url_commande = add_query_arg('order', $order->id, get_permalink(get_option('woocommerce_view_order_page_id')));
$montant_commande = woocommerce_price($order->order_total);
}
$compte_client = get_post_meta($order->id, '_customer_user', true);
printf("<p>" . __("Votre règlement par carte bancaire de %s a bien été finalisé auprès de notre banque"), $montant_commande);
if ($compte_client > 0) {
printf(__(", <a href=\"%s\">cliquez ici</a> pour consulter votre commande.", "atos") . "</p>", $url_commande);
} else {
echo ".</p>";
}
} elseif ($order->status != 'failed') {
if (version_compare(WOOCOMMERCE_VERSION, '2.0.14', '>=')) {
/* WC 2.1 */
$payer_url = $order->get_checkout_payment_url();
} else {
$payer_url = add_query_arg('order_id', $order->id, add_query_arg('order', $order->order_key, add_query_arg('pay_for_order', 'true', get_permalink(get_option('woocommerce_pay_page_id')))));
}
printf("<p>" . __("Échec du règlement par carte bancaire de votre commande, <a href=\"%s\">cliquez ici</a> pour effectuer une nouvelle tentative de paiement.", "atos") . "</p>", $payer_url);
/* WC 2.1 */
}
}
示例7: header
/**
* Check for Veritrans Web Response
* Method ini akan dipanggil untuk merespon notifikasi yang
* diberikan oleh server Veritrans serta melakukan verifikasi
* apakah notifikasi tersebut berasal dari Veritrans dan melakukan
* konfirmasi transaksi pembayaran yang dilakukan customer
*
* update: sekaligus untuk menjadi finish/failed URL handler.
* @access public
* @return void
*/
function veritrans_vtweb_response()
{
global $woocommerce;
@ob_clean();
global $woocommerce;
$order = new WC_Order($order_id);
Veritrans_Config::$isProduction = $this->environment == 'production' ? true : false;
if ($this->environment == 'production') {
Veritrans_Config::$serverKey = $this->server_key_v2_production;
} else {
Veritrans_Config::$serverKey = $this->server_key_v2_sandbox;
}
// check whether the request is GET or POST,
// if request == GET, request is for finish OR failed URL, then redirect to WooCommerce's order complete/failed
// else if request == POST, request is for payment notification, then update the payment status
if (!isset($_GET['order_id'])) {
// Check if POST, then create new notification
$veritrans_notification = new Veritrans_Notification();
if (in_array($veritrans_notification->status_code, array(200, 201, 202))) {
header('HTTP/1.1 200 OK');
if ($order->get_order($veritrans_notification->order_id) == true) {
$veritrans_confirmation = Veritrans_Transaction::status($veritrans_notification->order_id);
do_action("valid-veritrans-web-request", $veritrans_notification);
}
}
} else {
// else if GET, redirect to order complete/failed
// error_log('status_code '. $_GET['status_code']); //debug
// error_log('status_code '. $_GET['transaction_status']); //debug
if (isset($_GET['order_id']) && isset($_GET['transaction_status']) && ($_GET['transaction_status'] == 'capture' || $_GET['transaction_status'] == 'pending' || $_GET['transaction_status'] == 'settlement')) {
$order_id = $_GET['order_id'];
// error_log($this->get_return_url( $order )); //debug
$order = new WC_Order($order_id);
wp_redirect($order->get_checkout_order_received_url());
} else {
if (isset($_GET['order_id']) && isset($_GET['transaction_status']) && $_GET['transaction_status'] == 'deny') {
$order_id = $_GET['order_id'];
$order = new WC_Order($order_id);
wp_redirect($order->get_checkout_payment_url(false));
} else {
if (isset($_GET['order_id']) && !isset($_GET['transaction_status'])) {
// if customer click "back" button, redirect to checkout page again
$order_id = $_GET['order_id'];
$order = new WC_Order($order_id);
wp_redirect($order->get_checkout_payment_url(false));
}
}
}
}
}
示例8: change_payment_method_button
/**
* Add a "Change Payment Method" button to the "My Subscriptions" table.
*
* @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table
* @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table
* @since 1.4
*/
public static function change_payment_method_button($all_actions, $subscriptions)
{
foreach ($all_actions as $subscription_key => $actions) {
$order = new WC_Order($subscriptions[$subscription_key]['order_id']);
if (WC_Subscriptions_Manager::can_subscription_be_changed_to('new-payment-method', $subscription_key, get_current_user_id())) {
if (!WC_Subscriptions::is_woocommerce_pre_2_1()) {
// WC 2.1+
$url = add_query_arg(array('change_payment_method' => $subscription_key, 'order_id' => $order->id), $order->get_checkout_payment_url());
$url = wp_nonce_url($url, __FILE__);
} else {
$url = add_query_arg(array('change_payment_method' => $subscription_key, 'order_id' => $order->id, 'order' => $order->order_key), get_permalink(woocommerce_get_page_id('pay')));
$url = wp_nonce_url($url, __FILE__);
}
$all_actions[$subscription_key] = array('change_payment_method' => array('url' => $url, 'name' => __('Change Payment Method', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
}
}
return $all_actions;
}
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:25,代码来源:class-wc-subscriptions-change-payment-gateway.php
示例9: process_hosted_payments
/**
* Process standard payments.
*
* @param WC_Order $order
* @return array
*/
protected function process_hosted_payments($order)
{
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
}
示例10: processOrder
public function processOrder($order_id)
{
$order = new WC_Order($order_id);
$partsOforderNumber = $this->exploderOrderNumber($order->get_order_number());
$response = $this->prepareResponse();
$this->monetWebPay->log->write("Processing response, payId: " . $response->payId . " dttm: " . $response->dttm . " resultCode: " . $response->resultCode . " resultMessage: " . $response->resultMessage . " authCode: " . $response->authCode . " signature: " . $response->signature);
if ($this->monetWebPay->verifyPaymentResponseSignature($response, $this->publicKey, "payment response verify") == false) {
$this->monetWebPay->log->write('Response signature verification failed for payId ' . $response->payId);
$redirect = $order->get_checkout_payment_url(true);
$this->msg['message'] = 'Nepodařilo se ověřit podpis odpovědi';
$this->msg['class'] = 'error';
wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
return;
}
if ($response->resultCode != 0) {
$this->monetWebPay->log->write('Response resultCode is ' . $response->resultCode . " [" . $response->resultMessage . "] for payId " . $response->payId);
}
if ($response->paymentStatus == PaymentStatus::$approved) {
$this->monetWebPay->log->write('Received approved status for payId: ' . $response->payId);
$this->monetWebPay->updateTransactionStatus($partsOforderNumber[0], $response);
$this->msg['class'] = 'woocommerce_message';
$this->msg['message'] = sprintf(__('Platba byla zpracována a čeká v bance na zařazení do zúčtovaní. Číslo objednávky: %s', 'monet'), $partsOforderNumber[0]);
$order->add_order_note($this->msg['message']);
WC()->cart->empty_cart();
$order->payment_complete();
$order->update_status('on-hold');
} else {
if ($response->paymentStatus == PaymentStatus::$canceled) {
$this->monetWebPay->log->write('Received cancelled status for payId: ' . $response->payId);
$this->monetWebPay->clearTransaction($partsOforderNumber[0], $response);
$this->msg['message'] = sprintf(__('Platba byla na platební bráně zrušena zákazníkem. Číslo objednávky: %s', 'monet'), $partsOforderNumber[0]);
$this->msg['class'] = 'woocommerce_message woocommerce_message_info';
$order->add_order_note($this->msg['message']);
$order->update_status('failed');
wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
} else {
if ($response->paymentStatus == PaymentStatus::$declined) {
$this->monetWebPay->log->write('Received declined status for payId: ' . $response->payId);
$this->monetWebPay->clearTransaction($partsOforderNumber[0], $response);
$this->msg['message'] = 'Platba byla na platební bráně zamítnuta. Číslo objednávky: ' . $partsOforderNumber[0];
$this->msg['class'] = 'woocommerce_message woocommerce_message_info';
$order->add_order_note(sprintf($this->msg['message']));
$order->update_status('failed');
wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
} else {
if ($response->paymentStatus == PaymentStatus::$toClearing) {
$this->monetWebPay->log->write('Received to_clearing status for payId: ' . $response->payId);
$this->monetWebPay->updateTransactionStatus($partsOforderNumber[0], $response);
$this->msg['class'] = 'woocommerce_message woocommerce_message_info';
$this->msg['message'] = sprintf(__('Platba byla zpracována a je v bance zařazena do zúčtovaní. Číslo objednavky: %s', 'monet'), $partsOforderNumber[0]);
$order->add_order_note($this->msg['message']);
WC()->cart->empty_cart();
$order->payment_complete();
}
}
}
}
$location = $this->get_return_url($order);
wp_safe_redirect($location);
exit;
}
示例11: array
/**
* Process the payment and return the result
**/
function process_payment($order_id)
{
$order = new WC_Order($order_id);
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
}
示例12: array
/** Process Payment
* @param int $order_id
* @return array
*/
function process_payment($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
$this->log->add('pagantis', 'Acceso a la opción de pago con Paga+Tarde ');
// Return receipt_page redirect
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
}
示例13: array
/**
* Process the payment and return the result
**/
function process_payment($order_id)
{
$order = new WC_Order($order_id);
update_post_meta($order_id, '_post_data', $_POST);
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
}
示例14: process_payment
/**
* This function is called when user places order with paddle chosen as the payment method
* Redirect to payment page (handled by receipt_page() method)
* @param int $order_id
* @return mixed
*/
public function process_payment($order_id)
{
$order = new WC_Order($order_id);
if (version_compare(WOOCOMMERCE_VERSION, '2.1', '>=')) {
return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
} else {
return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(woocommerce_get_page_id('pay')))));
}
}
示例15: process_payment
public function process_payment($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
return array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order-pay', $order_id, $order->get_checkout_payment_url(true))));
}