class WC_Gateway_MyGateway extends WC_Payment_Gateway { public function __construct() { $this->id = 'mygateway'; $this->method_title = 'My Payment Gateway'; $this->method_description = 'Pay using MyGateway API'; $this->has_fields = false; $this->init_form_fields(); $this->init_settings(); add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); } public function process_payment($order_id) { // 1️⃣ Get the WooCommerce order $order = wc_get_order($order_id); // 2️⃣ Prepare API request data $api_key = $this->get_option('api_key'); // Admin saved API key $body = array( 'amount' => $order->get_total(), 'currency' => $order->get_currency(), 'order_id' => $order->get_id(), 'api_key' => $api_key ); // 3️⃣ Send POST request to 3rd-party API $response = wp_remote_post('https://api.yourgateway.com/pay', array( 'method' => 'POST', 'body' => $body, 'timeout' => 60, 'headers' => array('Accept' => 'application/json') )); // 4️⃣ Handle response if (is_wp_error($response)) { wc_add_notice('Payment failed: Unable to connect to payment gateway.', 'error'); return; } $response_body = wp_remote_retrieve_body($response); $result = json_decode($response_body, true); if ($result['status'] === 'success') { // Payment succeeded $order->payment_complete(); // WooCommerce handles stock, emails, etc. return array( 'result' => 'success', 'redirect' => $this->get_return_url($order) ); } else { // Payment failed wc_add_notice('Payment failed: ' . $result['message'], 'error'); return; } } About -
Close-up of a 3D printer creating a hexagonal object in a dimly lit workspace.

Discover EZlabstudio: Where 3D Printing Meets Creativity

Get to Know EZlabstudio

EZlabstudio, founded by Ezra, specializes in producing custom 3D-printed keychains and small items. With a passion for creativity and quality, we offer a modern online platform for customers to personalize their purchases. Choose from various colors, text options, UV glossy finishes, or upload your custom designs. We pride ourselves on providing affordable, personalized products coupled with fast and flat-rate shipping, ensuring a delightful shopping experience.

Our clients enjoy uniqueHi, my name is Ezra. I saved up my money to buy a 3D printer, and that’s how I started making custom keychains and small 3D-printed items. What began as a personal goal turned into a small business I’m proud of.
Some of my items are made ahead of time, while others are customized when ordered. I focus on creating affordable, quality products with options like custom names and glossy UV finishes.
Keychains start at $7, UV glossy finish is $3 extra, and shipping is about $5. If you purchase 5 keychains, shipping is free. Every order helps support my journey, and I truly appreciate everyone who supports my small business.

Close-up of a modern milling machine producing a 3D model rocket, highlighting technology and precision.
Group of diverse kids collaborating on a 3D printing project using a laptop and other devices.

At EZlabstudio, we believe every creation should tell a unique story.

Ezra, Founder

Our dedication to quality and customer satisfaction drives our mission to deliver remarkable, tailor-made products.

3D printing heart design in workshop setting. Perfect for Valentine creativity concepts.
Close-up of a 3D printer creating a hexagonal object in a dimly lit workspace.

The Journey of EZlabstudio: From Hobby to Business

EZlabstudio began as a personal project for Ezra, who turned his passion for 3D printing into a thriving small business. It has since evolved into a platform where creativity meets affordability. With a focus on personalized products and exceptional service, we strive to bring unique visions to life efficiently and stylishly.

Join Our Community

Stay Updated on Our Latest Designs!

Subscribe for exclusive offers and be the first to see our new 3D-printed creations.

Scroll to Top
0

Subtotal