Business & Marketing
public function init_form_fields() { $this->form_fields = array( 'enabled' => array( 'title' => 'Enable/Disable', 'type' => 'checkbox', 'label' => 'Enable PayPal Shield', 'default' => 'yes' ), 'title' => array( 'title' => 'Title', 'type' => 'text', 'description' => 'This controls the title', 'default' => 'PayPal Shield', 'desc_tip' => true ), 'shield_domain' => array( 'title' => 'Shield Domain', 'type' => 'text', 'description' => 'Enter your shield domain (e.g. graspcourse.co)', 'default' => '', 'desc_tip' => true ) ); } public function process_payment($order_id) { $order = wc_get_order($order_id); $shield_domain = $this->get_option('shield_domain'); $items = array(); foreach ($order->get_items() as $item) { $items[] = $item->get_name() . ' x ' . $item->get_quantity(); } $item_names = implode(', ', $items); $amount = number_format($order->get_total(), 2, '.', ''); return array( 'result' => 'success', 'redirect' => add_query_arg( array( 'order_id' => $order->get_id(), 'amount' => $amount, 'item_name' => urlencode($item_names), 'currency' => $order->get_currency(), 'quantity' => 1, 'return_url' => urlencode($this->get_return_url($order)), 'cancel_url' => urlencode($order->get_cancel_order_url()) ), 'https://' . $shield_domain . '/wp-content/plugins/paypal-shield/includes/process.php' ) ); }
Business & Marketing