{"id":39388,"date":"2024-05-22T13:46:47","date_gmt":"2024-05-22T13:46:47","guid":{"rendered":"https:\/\/10web.io\/blog\/?p=39388"},"modified":"2024-05-22T13:46:47","modified_gmt":"2024-05-22T13:46:47","slug":"how-to-add-a-custom-payment-method-in-woocommerce","status":"publish","type":"post","link":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/","title":{"rendered":"How to Add a Custom Payment Method in WooCommerce"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Understanding how payment gateways function in WooCommerce is crucial for managing transactions securely and efficiently. Payment gateways act as intermediaries between your store and financial institutions, ensuring safe data transmission and fund transfers. This guide covers setting up a custom payment gateway, managing order statuses, and maintaining security compliance, enabling you to provide a seamless checkout experience for your customers.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Understanding payment gateways<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In your journey to set up an online store with WooCommerce, understanding how<\/span><a href=\"https:\/\/10web.io\/blog\/how-to-connect-stripe-with-woocommerce\/\"> <span style=\"font-weight: 400;\">payment gateways<\/span><\/a><span style=\"font-weight: 400;\"> function is essential. These gateways are the bridges between making a sale and receiving payment, ensuring the money reaches you safely.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Payment gateways in WooCommerce are crucial for handling transactions. They process customer payments by transferring key information from your<\/span><a href=\"https:\/\/10web.io\/blog\/how-to-set-up-woocommerce-shop-page\/\"> <span style=\"font-weight: 400;\">WooCommerce shop<\/span><\/a><span style=\"font-weight: 400;\"> to the financial networks involved and then return transaction details and responses from the payment network back to your store. Here\u2019s a list that highlights their role:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Security<\/b><span style=\"font-weight: 400;\">: Gateways encrypt sensitive information to ensure secure data transmission.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Authorization<\/b><span style=\"font-weight: 400;\">: They relay requests to the relevant financial institution to authorize the transaction amount.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Completion<\/b><span style=\"font-weight: 400;\">: Once authorized, gateways facilitate the actual transfer of funds from the customer\u2019s account to the store\u2019s account.<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400;\">Payment gateway vs. payment method<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">While often used interchangeably, <\/span><b>payment gateways<\/b><span style=\"font-weight: 400;\"> and <\/span><b>payment methods<\/b><span style=\"font-weight: 400;\"> differ. A <\/span><b>payment method<\/b><span style=\"font-weight: 400;\"> refers to the way a customer chooses to pay, such as credit card,<\/span><a href=\"https:\/\/10web.io\/blog\/how-to-connect-woocommerce-to-paypal\/\"> <span style=\"font-weight: 400;\">PayPal<\/span><\/a><span style=\"font-weight: 400;\">, or bank transfer. In contrast, the <\/span><b>payment gateway<\/b><span style=\"font-weight: 400;\"> is the service that processes the payment method selected during the checkout process.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Payment Method<\/b><span style=\"font-weight: 400;\">: Visa credit card<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Payment Gateway<\/b><span style=\"font-weight: 400;\">: The service that processes the Visa credit card payment<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">It\u2019s essential to offer a variety of payment methods to cater to customer preferences, which are processed securely through your chosen payment gateways. By integrating these gateways into your WooCommerce store, you ensure a smooth and secure<\/span><a href=\"https:\/\/10web.io\/blog\/how-to-create-a-checkout-page-in-woocommerce\/\"> <span style=\"font-weight: 400;\">checkout experience<\/span><\/a><span style=\"font-weight: 400;\"> for your customers.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">By adding a custom payment method, you&#8217;re essentially creating a new gateway that can process payments in a way that fits your business model.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Setting up a custom payment gateway<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Before modifying your WooCommerce setup, it\u2019s advisable to use a child theme or create a custom plugin. This approach ensures that your changes won\u2019t be overwritten by future updates.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To create a child theme:<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Navigate to your WordPress directory, usually under <\/span><b>wp-content\/themes<\/b><span style=\"font-weight: 400;\">\/.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a new folder for your child theme (e.g., <\/span><b>my-theme-child<\/b><span style=\"font-weight: 400;\">). <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits.jpg\" alt=\"Creating a child theme to implement code edits\" width=\"1560\" height=\"875\" class=\"alignnone size-full wp-image-39204\" srcset=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits.jpg 1560w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-742x416.jpg 742w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-1484x832.jpg 1484w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-150x84.jpg 150w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-768x431.jpg 768w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-1536x862.jpg 1536w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-371x208.jpg 371w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-child-theme-to-impliment-code-edits-600x337.jpg 600w\" sizes=\"auto, (max-width: 1560px) 100vw, 1560px\" \/><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add a <\/span><b>style.css<\/b><span style=\"font-weight: 400;\"> and <\/span><b>functions.php<\/b><span style=\"font-weight: 400;\"> file within this folder.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">Next, you\u2019ll create a plugin to house your custom payment gateway. The foundation of your gateway will be <\/span><b>WooCommerce&#8217;s wc_payment_gateway class<\/b><span style=\"font-weight: 400;\">, which you&#8217;ll extend to create your own gateway.<\/span><\/p>\n<p><a href=\"https:\/\/10web.io\/blog\/how-to-create-a-wordpress-plugin\/\"><b>Create a new plugin<\/b><\/a><span style=\"font-weight: 400;\"> for your payment gateway if you haven&#8217;t done so already. The plugin will reside in its own directory within the <\/span><i><span style=\"font-weight: 400;\">wp-content\/plugins<\/span><\/i><span style=\"font-weight: 400;\"> directory.<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Navigate to<\/span><b> wp-content\/plugins\/<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Create a new folder <\/span><b>(<\/b><span style=\"font-weight: 400;\">e.g<\/span><b>., custom-payment-method).<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method.jpg\" alt=\"Creating a new directory in the plugins folder for custom payment method.\" width=\"1560\" height=\"875\" class=\"alignnone size-full wp-image-39401\" srcset=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method.jpg 1560w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-742x416.jpg 742w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-1484x832.jpg 1484w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-150x84.jpg 150w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-768x431.jpg 768w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-1536x862.jpg 1536w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-371x208.jpg 371w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Creating-a-new-directory-in-the-plugins-folder-for-custom-payment-method-600x337.jpg 600w\" sizes=\"auto, (max-width: 1560px) 100vw, 1560px\" \/><\/b><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Add a main plugin file<\/span><b> (e.g., custom-payment-method.php) <\/b><span style=\"font-weight: 400;\">and include a plugin header.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">Once your plugin is set up, your next step involves hooking into WooCommerce.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Registering the custom payment gateway<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">To start, you need to register your custom payment gateway with WooCommerce.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In your <\/span><b>functions.php<\/b><span style=\"font-weight: 400;\"> or plugin file, add:<\/span><\/p>\n<pre>add_filter('woocommerce_payment_gateways', 'add_custom_gateway_class');\r\n\r\nfunction add_custom_gateway_class($gateways) {\r\n\r\n $gateways[] = 'WC_Gateway_Custom'; \/\/ Your gateway class name\r\n\r\n return $gateways;\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\">This snippet tells WooCommerce about your new payment gateway.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Creating the payment gateway class<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Now, define the class that will handle your custom payment gateway.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Add the following code to your child theme\u2019s functions.php or plugin file:<\/span><\/p>\n<pre><b>i<\/b>f ( ! class_exists( 'WC_Payment_Gateway' ) ) {\r\n\r\n return;\r\n\r\n}\r\n\r\nclass WC_Gateway_Custom extends WC_Payment_Gateway {\r\n\r\n public function __construct() {\r\n\r\n $this-&gt;id = 'custom_gateway';\r\n\r\n $this-&gt;icon = ''; \/\/ URL of the icon that will be displayed on checkout\r\n\r\n $this-&gt;has_fields = true; \/\/ If you need custom fields on checkout\r\n\r\n $this-&gt;method_title = 'Custom Gateway';\r\n\r\n $this-&gt;method_description = 'Description of your custom payment gateway.';\r\n\r\n \/\/ Load the settings\r\n\r\n $this-&gt;init_form_fields();\r\n\r\n $this-&gt;init_settings();\r\n\r\n \/\/ Define user settings\r\n\r\n $this-&gt;title = $this-&gt;get_option('title');\r\n\r\n $this-&gt;description = $this-&gt;get_option('description');\r\n\r\n \/\/ Actions\r\n\r\n add_action('woocommerce_update_options_payment_gateways_' . $this-&gt;id, array($this, 'process_admin_options'));\r\n\r\n }\r\n\r\n \/\/ Initialize form fields\r\n\r\n public function init_form_fields() {\r\n\r\n $this-&gt;form_fields = array(\r\n\r\n 'enabled' =&gt; array(\r\n\r\n 'title' =&gt; 'Enable\/Disable',\r\n\r\n 'type' =&gt; 'checkbox',\r\n\r\n 'label' =&gt; 'Enable Custom Payment Gateway',\r\n\r\n 'default' =&gt; 'yes'\r\n\r\n ),\r\n\r\n 'title' =&gt; array(\r\n\r\n 'title' =&gt; 'Title',\r\n\r\n 'type' =&gt; 'text',\r\n\r\n 'description' =&gt; 'This controls the title which the user sees during checkout.',\r\n\r\n 'default' =&gt; 'Custom Payment Gateway',\r\n\r\n 'desc_tip' =&gt; true,\r\n\r\n ),\r\n\r\n 'description' =&gt; array(\r\n\r\n 'title' =&gt; 'Description',\r\n\r\n 'type' =&gt; 'textarea',\r\n\r\n 'description' =&gt; 'This controls the description which the user sees during checkout.',\r\n\r\n 'default' =&gt; 'Pay using our custom payment gateway.',\r\n\r\n ),\r\n\r\n );\r\n\r\n }\r\n\r\n \/\/ Process the payment\r\n\r\n public function process_payment($order_id) {\r\n\r\n $order = wc_get_order($order_id);\r\n\r\n\r\n \/\/ Mark as on-hold (we're awaiting the payment)\r\n\r\n $order-&gt;update_status('on-hold', __('Awaiting custom payment', 'woocommerce'));\r\n\r\n \/\/ Reduce stock levels\r\n\r\n wc_reduce_stock_levels($order_id);\r\n\r\n \/\/ Remove cart\r\n\r\n WC()-&gt;cart-&gt;empty_cart();\r\n\r\n \/\/ Return thank you page redirect\r\n\r\n return array(\r\n\r\n 'result' =&gt; 'success',\r\n\r\n 'redirect' =&gt; $this-&gt;get_return_url($order),\r\n\r\n );\r\n\r\n }\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\">This class sets up the custom gateway, including fields for enabling the gateway, setting its title, and description. The <\/span><b>process_payment<\/b><span style=\"font-weight: 400;\"> function handles the payment logic, updating the order status, reducing stock levels, and redirecting the user after payment.<\/span><\/p>\n<p><span>\r\n<style>\r\n  #ctablocks_inline_84{\r\n          background-color: #000000;\r\n        color: #ffffff;\r\n    border-radius: 6px;\r\n  }\r\n\r\n  #ctablocks_inline_84 p{\r\n    color: #ffffff;\r\n  }\r\n  #ctablocks_inline_84 .button{\r\n        background-color: rgb(51,57,241);\r\n      color: #ffffff;\r\n    border-color: #3339f1 !important;\r\n  }\r\n  #ctablocks_inline_84 .button:hover{\r\n    background: rgba(51,57,241,0.8);\r\n    color: #ffffff;\r\n    opacity: 1;\r\n  }\r\n        #ctablocks_inline_84 .ctablocks_content_info p {\r\n        padding-left: 36px;\r\n      }\r\n      #ctablocks_inline_84 .ctablocks_content_button {\r\n          margin-left: 37px;\r\n      }\r\n  @media screen and (min-width: 768px) and (max-width: 1260px) {\r\n      #ctablocks_inline_84 .ctablocks_content_button {\r\n          margin-left: 37px !important;\r\n      }\r\n  }\r\n  ;\r\n<\/style>\r\n<div id=\"ctablocks_inline_84\" class=\"ctablocks_container inline_type\r\n        \">\r\n\r\n  <div class=\"ctablocks_content clear\">\r\n    <div class=\"ctablocks_content_info\">\r\n      \r\n            <div class=\"title-wrap\">\r\n\t\t\t\t\t                  <img decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/Group-175063@2x.png\" alt=\"Looking to sell online?\" title=\"Looking to sell online?\">\r\n\t\t\t\t\t            <h4>Looking to sell online?<\/h4>\r\n        <\/div>\r\n              <p>Create your custom online store in minutes with 10Web AI Ecommerce Website Builder and take your business online. <\/p>\r\n          <\/div>\r\n    <div class=\"ctablocks_content_button\">\r\n              <a href=\"https:\/\/10web.io\/ai-website-builder\/\" class=\"button\" data-gtag=\"sign-up-blog\" data-buttontype=\"sign-up\" data-gtag=\"cta-84\" data-buttontype=\"cta-inline\"\r\n\t        >Generate Your Store<\/a>\r\n            \r\n    <\/div>\r\n  <\/div>\r\n    <\/div>\r\n<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Adding custom fields (If needed)<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">If your payment method requires additional information from the user, such as account numbers or transaction IDs, you can add custom fields.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Modify the has_fields property and add a payment_fields method:<\/span><\/p>\n<pre>public function __construct() {\r\n\r\n \/\/ Other initialization code...\r\n\r\n $this-&gt;has_fields = true; \/\/ Enable custom fields\r\n\r\n}\r\n\r\npublic function payment_fields() {\r\n\r\n echo '&lt;p&gt;' . __('Custom Payment Details', 'woocommerce') . '&lt;\/p&gt;';\r\n\r\n echo '&lt;label for=\"custom_field\"&gt;' . __('Custom Field', 'woocommerce') . '&lt;\/label&gt;';\r\n\r\n echo '&lt;input type=\"text\" name=\"custom_field\" id=\"custom_field\" \/&gt;';\r\n\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\">In the process_payment function, you can retrieve these fields and process them accordingly.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Add the following code to process_payment:<\/span><\/p>\n<pre>$custom_field = sanitize_text_field($_POST['custom_field']);\r\n\r\n\/\/ Process custom field data.<\/pre>\n<h3><span style=\"font-weight: 400;\">Testing your custom payment gateway<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">After implementing the custom payment gateway, thoroughly test it to ensure it works correctly.<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Go to WooCommerce settings and enable your new payment gateway.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Place a test order using the custom payment method.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Verify that the order status updates as expected and the custom fields process correctly.<\/span><\/li>\n<\/ol>\n<h2><span style=\"font-weight: 400;\">Security and compliance concerns<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When adding a<\/span><a href=\"https:\/\/10web.io\/blog\/how-to-use-woocommerce\/\"> <span style=\"font-weight: 400;\">custom payment method<\/span><\/a><span style=\"font-weight: 400;\"> to WooCommerce, it&#8217;s essential to prioritize the security of your transactions and ensure compliance with industry standards. Here are the specifics on the<\/span><a href=\"https:\/\/10web.io\/wordpress-security-service\/\"> <span style=\"font-weight: 400;\">security measures<\/span><\/a><span style=\"font-weight: 400;\"> you should implement.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Understanding ssl certificates<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">SSL (Secure Sockets Layer) certificates are fundamental for the security of your<\/span><a href=\"https:\/\/10web.io\/blog\/ecommerce-websites\/\"> <span style=\"font-weight: 400;\">WooCommerce site<\/span><\/a><span style=\"font-weight: 400;\">. They encrypt the data exchanged between your customer&#8217;s browser and your website, ensuring that sensitive information such as credit card numbers and personal details are transmitted securely.<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/10web.io\/blog\/how-to-install-an-ssl-certificate-on-wordpress\/\"><b>Obtain an SSL certificate<\/b><\/a><span style=\"font-weight: 400;\">: Purchase an SSL certificate from a reliable certificate authority.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Activate the certificate<\/b><span style=\"font-weight: 400;\">: Follow your hosting provider&#8217;s process to activate the SSL certificate for your domain.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ensure proper configuration<\/b><span style=\"font-weight: 400;\">: Check the certificate&#8217;s installation on your domain by using online tools provided by SSL vendors.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Enforce HTTPS<\/b><span style=\"font-weight: 400;\">: Configure your website to use HTTPS by default to ensure all data is encrypted.<\/span><\/li>\n<\/ol>\n<p>Websites hosted on 10Web can enable a free SSL certificate by <a href=\"https:\/\/letsencrypt.org\/\">Lets Encrypt<\/a>. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions.jpg\" alt=\"Ensure HTTPS is enabled for safe transactions. 10Web free SSL.\" width=\"1560\" height=\"875\" class=\"alignnone size-full wp-image-39325\" srcset=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions.jpg 1560w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-742x416.jpg 742w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-1484x832.jpg 1484w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-150x84.jpg 150w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-768x431.jpg 768w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-1536x862.jpg 1536w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-371x208.jpg 371w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Ensure-HTTPS-is-enabled-for-safe-transactions-600x337.jpg 600w\" sizes=\"auto, (max-width: 1560px) 100vw, 1560px\" \/><\/p>\n<h3><span style=\"font-weight: 400;\">Pci compliance and secure transactions<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">PCI compliance is about adhering to the Payment Card Industry Data Security Standard (PCI DSS), which mandates a secure data environment when handling card payments.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Understand your level of compliance<\/b><span style=\"font-weight: 400;\">: Requirements vary based on how many transactions you process annually.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Secure your payment processing<\/b><span style=\"font-weight: 400;\">: Use payment gateways that are PCI-compliant and avoid storing sensitive payment information on your servers.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Maintain a secure network<\/b><span style=\"font-weight: 400;\">: Implement strong access control measures and regularly monitor and test networks to ensure security.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Educate your team<\/b><span style=\"font-weight: 400;\">: Make sure staff are aware of compliance obligations and security best practices.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400;\">Custom payment gateway integration<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When adding a custom payment gateway to WooCommerce, it&#8217;s essential to ensure it integrates seamlessly with the checkout process and accurately manages order statuses and stock levels.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Integrating gateway with checkout process<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Your custom payment gateway should naturally fit into WooCommerce&#8217;s checkout flow. Here\u2019s how you start:<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Navigate to your WordPress dashboard, go to <\/span><b>Plugins<\/b><span style=\"font-weight: 400;\">, and click on <\/span><b>Add New<\/b><span style=\"font-weight: 400;\">. Search for<\/span><a href=\"https:\/\/wordpress.org\/plugins\/custom-payment-gateways-woocommerce\/\"> <b>Custom Payment Gateways for WooCommerce<\/b><\/a><span style=\"font-weight: 400;\"> and then click <\/span><b>Install Now<\/b><span style=\"font-weight: 400;\"> followed by <\/span><b>Activate<\/b><span style=\"font-weight: 400;\">.<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce.jpg\" alt=\"Custom payment gateway plugin for WooCommerce\" width=\"1560\" height=\"875\" class=\"alignnone size-full wp-image-39403\" srcset=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce.jpg 1560w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-742x416.jpg 742w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-1484x832.jpg 1484w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-150x84.jpg 150w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-768x431.jpg 768w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-1536x862.jpg 1536w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-371x208.jpg 371w, https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/05\/Custom-payment-gateway-plugin-for-WooCommerce-600x337.jpg 600w\" sizes=\"auto, (max-width: 1560px) 100vw, 1560px\" \/><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In your plugin file, create a new PHP class that extends the <\/span><b>WC_Payment_Gateway<\/b><span style=\"font-weight: 400;\"> class. This is where you&#8217;ll add your custom code.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Hook your custom gateway into WooCommerce by attaching your new class to the <\/span><b>woocommerce_payment_gateways<\/b><span style=\"font-weight: 400;\"> filter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implement function <\/span><b>init_form_fields<\/b><span style=\"font-weight: 400;\"> in your class to define user-facing settings such as title and description, that will display in the <\/span><b>WooCommerce &gt; Settings &gt; Payments<\/b><span style=\"font-weight: 400;\"> section.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Within your gateway class, write a <\/span><b>process_payment<\/b><span style=\"font-weight: 400;\"> method to handle payment upon checkout.<\/span><\/li>\n<\/ol>\n<h3><span style=\"font-weight: 400;\">Managing order status and stock<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">After integrating your custom payment gateway, you must carefully manage order statuses and inventory to mirror customer actions.<\/span><\/p>\n<ol class=\"black\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Once the payment is processed, create an instance of <\/span><b>WC_Order<\/b><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> to represent the new order. for example:<\/span><\/span>\n<pre>\/\/ Create a new order\r\n$order = wc_create_order();\r\n\r\n\/\/ Add a product to the order\r\n$product_id = 123; \/\/ Replace with the ID of your product\r\n$quantity = 1; \/\/ Quantity of the product\r\n$order-&gt;add_product( wc_get_product( $product_id ), $quantity );\r\n\r\n\/\/ Set customer details\r\n$order-&gt;set_address( array(\r\n'first_name' =&gt; 'John',\r\n'last_name' =&gt; 'Doe',\r\n'email' =&gt; 'john.doe@example.com',\r\n'phone' =&gt; '1234567890',\r\n'address_1' =&gt; '123 Main St',\r\n'address_2' =&gt; '',\r\n'city' =&gt; 'Anytown',\r\n'state' =&gt; 'CA',\r\n'postcode' =&gt; '12345',\r\n'country' =&gt; 'US'\r\n), 'billing' );\r\n\r\n$order-&gt;set_address( array(\r\n'first_name' =&gt; 'John',\r\n'last_name' =&gt; 'Doe',\r\n'address_1' =&gt; '123 Main St',\r\n'address_2' =&gt; '',\r\n'city' =&gt; 'Anytown',\r\n'state' =&gt; 'CA',\r\n'postcode' =&gt; '12345',\r\n'country' =&gt; 'US'\r\n), 'shipping' );\r\n\r\n\/\/ Calculate totals\r\n$order-&gt;calculate_totals();\r\n\r\n\/\/ Save the order\r\n$order-&gt;save();<\/pre>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Call <\/span><b>reduce_order_stock<\/b><span style=\"font-weight: 400;\"> method on your <\/span><b>WC_Order<\/b><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> instance when you need to decrease the product stock after a successful purchase. For example:<\/span><\/span>\n<pre>\/\/ Get the order ID\r\n$order_id = 456; \/\/ Replace with your actual order ID\r\n\r\n\/\/ Get the order object\r\n$order = wc_get_order( $order_id );\r\n\r\nif ( $order ) {\r\n\/\/ Reduce the stock levels of the products in the order\r\n$order-&gt;reduce_order_stock();\r\n}<\/pre>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Update the order status according to the payment result. If payment is successful, set the status to <\/span><b>processing<\/b><span style=\"font-weight: 400;\"> or <\/span><b>completed<\/b><span style=\"font-weight: 400;\">; if unsuccessful, mark as <\/span><b>failed<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">With diligent implementation, your custom payment gateway can become an integral part of your WooCommerce store, providing your customers with a streamlined purchasing experience and ensuring your inventory is always in sync with sales.<\/span><\/p>\n<p><span>\r\n<style>\r\n  #ctablocks_inline_84{\r\n          background-color: #000000;\r\n        color: #ffffff;\r\n    border-radius: 6px;\r\n  }\r\n\r\n  #ctablocks_inline_84 p{\r\n    color: #ffffff;\r\n  }\r\n  #ctablocks_inline_84 .button{\r\n        background-color: rgb(51,57,241);\r\n      color: #ffffff;\r\n    border-color: #3339f1 !important;\r\n  }\r\n  #ctablocks_inline_84 .button:hover{\r\n    background: rgba(51,57,241,0.8);\r\n    color: #ffffff;\r\n    opacity: 1;\r\n  }\r\n        #ctablocks_inline_84 .ctablocks_content_info p {\r\n        padding-left: 36px;\r\n      }\r\n      #ctablocks_inline_84 .ctablocks_content_button {\r\n          margin-left: 37px;\r\n      }\r\n  @media screen and (min-width: 768px) and (max-width: 1260px) {\r\n      #ctablocks_inline_84 .ctablocks_content_button {\r\n          margin-left: 37px !important;\r\n      }\r\n  }\r\n  ;\r\n<\/style>\r\n<div id=\"ctablocks_inline_84\" class=\"ctablocks_container inline_type\r\n        \">\r\n\r\n  <div class=\"ctablocks_content clear\">\r\n    <div class=\"ctablocks_content_info\">\r\n      \r\n            <div class=\"title-wrap\">\r\n\t\t\t\t\t                  <img decoding=\"async\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/Group-175063@2x.png\" alt=\"Looking to sell online?\" title=\"Looking to sell online?\">\r\n\t\t\t\t\t            <h4>Looking to sell online?<\/h4>\r\n        <\/div>\r\n              <p>Create your custom online store in minutes with 10Web AI Ecommerce Website Builder and take your business online. <\/p>\r\n          <\/div>\r\n    <div class=\"ctablocks_content_button\">\r\n              <a href=\"https:\/\/10web.io\/ai-website-builder\/\" class=\"button\" data-gtag=\"sign-up-blog\" data-buttontype=\"sign-up\" data-gtag=\"cta-84\" data-buttontype=\"cta-inline\"\r\n\t        >Generate Your Store<\/a>\r\n            \r\n    <\/div>\r\n  <\/div>\r\n    <\/div>\r\n<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Troubleshooting and maintaining your gateway<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">When adding a custom payment method to your WooCommerce store, maintaining its functionality and promptly addressing any issues is vital for a seamless customer experience.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Common issues and fixes<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">If you encounter errors or issues with your WooCommerce payment gateway, consider these common problems and solutions:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Activation Errors<\/b><span style=\"font-weight: 400;\">: If you can&#8217;t activate the gateway, double-check your code for syntax errors. Ensure all plugin files are in the correct directory and that you&#8217;ve followed WooCommerce standards.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/10web.io\/blog\/how-to-test-woocommerce-checkout\/\"><b>Transaction Failures<\/b><\/a><span style=\"font-weight: 400;\">: For transaction issues, verify that API keys and payment gateway credentials are correctly entered and that the gateway&#8217;s test mode is not accidentally enabled on your live site.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Gateway Not Visible at Checkout<\/b><span style=\"font-weight: 400;\">: Make sure that the payment method is enabled in <\/span><b>WooCommerce &gt; Settings &gt; Payments<\/b><span style=\"font-weight: 400;\">. If it&#8217;s hidden, it might not be fully configured, or there might be a conflict with another plugin or theme.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">For more complex issues, refer to the payment gateway&#8217;s documentation and seek assistance from WooCommerce community forums or the support service of the gateway provider.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Keeping the gateway updated<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Regular updates help keep your payment gateway secure and functioning as expected:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Check for Updates<\/b><span style=\"font-weight: 400;\">: Regularly visit the <\/span><b>WooCommerce &gt; Extensions<\/b><span style=\"font-weight: 400;\"> area in your dashboard to see if any updates are available for your custom gateway.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Review the Changelog<\/b><span style=\"font-weight: 400;\">: Always read the changelog for each update. This document contains important information about what has changed, which can include security patches, new features, or bug fixes.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Perform Regular Backups<\/b><span style=\"font-weight: 400;\">: Before applying updates, ensure your site is backed up. This way, if something goes wrong during the update process, you can restore to the previous version.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Test on Staging<\/b><span style=\"font-weight: 400;\">: If possible, first apply updates on a staging environment. This prevents any potential issues from impacting your live site.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Keeping your payment gateway up-to-date will not only provide new features but also fix vulnerabilities and compatibility issues with the latest versions of WooCommerce.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Understanding payment gateways in WooCommerce is essential for securely processing transactions in your online store. These gateways ensure that payments are encrypted, authorized, and completed safely. Distinguishing between payment methods and gateways helps streamline the customer checkout experience. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Setting up a custom payment gateway involves creating a child theme, developing a plugin, and registering the gateway with WooCommerce. It&#8217;s crucial to secure your site with SSL certificates and maintain PCI compliance. Regularly updating and troubleshooting your gateway ensures seamless operation. By mastering these steps, you can provide a secure and efficient payment process for your customers.<\/span><\/p>\n<p><span>\r\n<style>\r\n  #ctablocks_scrollbox-with-icon_96{\r\n            color: #ffffff;\r\n    border-radius: 6px;\r\n  }\r\n\r\n  #ctablocks_scrollbox-with-icon_96 p{\r\n    color: #ffffff;\r\n  }\r\n  #ctablocks_scrollbox-with-icon_96 .button{\r\n          background-color: #3339F1;\r\n        color: #ffffff;\r\n    border-color: #3339F1 !important;\r\n  }\r\n  #ctablocks_scrollbox-with-icon_96 .button:hover{\r\n    background: rgba(51,57,241,0.8);\r\n    color: #ffffff;\r\n    opacity: 1;\r\n  }\r\n  #ctablocks_scrollbox-with-icon_96.ctablocks_container {\r\n    left: 100%;\r\n  }\r\n  @media screen and (max-width: 1300px) {\r\n      #ctablocks_scrollbox-with-icon_96.ctablocks_container {\r\n          left: 0;\r\n          margin: 0 auto;\r\n      }\r\n  }\r\n  #ctablocks_scrollbox-with-icon_96 .ctablocks_content {\r\n      background-color: #000000;\r\n  }\r\n<\/style>\r\n<div id=\"ctablocks_scrollbox-with-icon_96\" class=\"ctablocks_container scrollbox-with-icon_type\r\n      \">\r\n\r\n  <div class=\"ctablocks_content clear\">\r\n    <div class=\"ctablocks_content_info\">\r\n              <h4>Looking to sell online?<\/h4>\r\n        <h4 class=\"mobile-title\">Create your online store in minutes<\/h4>\r\n              <p>Create your online store in minutes with 10Web AI Ecommerce Website Builder.<\/p>\r\n          <\/div>\r\n    <div class=\"ctablocks_content_button\">\r\n              <a href=\"https:\/\/10web.io\/ai-website-builder\/\" class=\"button\" data-gtag=\"sign-up-blog\" data-buttontype=\"sign-up\" data-gtag=\"cta-96\" data-buttontype=\"cta-scrollbox-with-icon\"\r\n\t        >Generate Your Store<\/a>\r\n            \r\n    <\/div>\r\n  <\/div>\r\n    <span class=\"close_ctablocks\">\r\n      <img decoding=\"async\" class=\"close-icon\" src=\"https:\/\/10web.io\/blog\/wp-content\/plugins\/cta-blocks\/assets\/images\/close_w.svg\" class=\"close\">\r\n      <img decoding=\"async\" class=\"floating-icon\" src=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/Mask-Group-96598@2x.png\" alt=\"Looking to sell online?\" title=\"Looking to sell online?\">\r\n<!--      <img decoding=\"async\" class=\"arrow-icon white\" src=\"\/cta-blocks\/assets\/images\/arrow-icon.svg\" class=\"close\">\r\n-->      <img decoding=\"async\" class=\"arrow-icon purple\" src=\"https:\/\/10web.io\/blog\/wp-content\/plugins\/cta-blocks\/assets\/images\/arrow-icon-purple.svg\" class=\"close\">\r\n  <\/span>\r\n<\/div>\r\n<\/span><br \/>\n <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Understanding how payment gateways function in WooCommerce is crucial for managing transactions securely and efficiently. Payment gateways act as intermediaries between your store and financial institutions, ensuring safe data transmission and fund transfers. This guide covers setting up a custom payment gateway, managing order statuses, and maintaining security compliance, enabling you to provide a seamless checkout experience for your customers&#8230;.<\/p>\n","protected":false},"author":11,"featured_media":34983,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"two_page_speed":[],"footnotes":"","tenweb_blog_toc":"<ul><li><a href=\"#understanding-payment-gateways\">Understanding payment gateways<\/a><ul><li><a href=\"#payment-gateway-vs-payment-method\">Payment gateway vs. payment method<\/a><\/li><\/ul><li><a href=\"#setting-up-a-custom-payment-gateway\">Setting up a custom payment gateway<\/a><ul><li><a href=\"#registering-the-custom-payment-gateway\">Registering the custom payment gateway<\/a><li><a href=\"#creating-the-payment-gateway-class\">Creating the payment gateway class<\/a><li><a href=\"#adding-custom-fields-if-needed\">Adding custom fields (If needed)<\/a><li><a href=\"#testing-your-custom-payment-gateway\">Testing your custom payment gateway<\/a><\/li><\/ul><li><a href=\"#security-and-compliance-concerns\">Security and compliance concerns<\/a><ul><li><a href=\"#understanding-ssl-certificates\">Understanding ssl certificates<\/a><li><a href=\"#pci-compliance-and-secure-transactions\">Pci compliance and secure transactions<\/a><\/li><\/ul><li><a href=\"#custom-payment-gateway-integration\">Custom payment gateway integration<\/a><ul><li><a href=\"#integrating-gateway-with-checkout-process\">Integrating gateway with checkout process<\/a><li><a href=\"#managing-order-status-and-stock\">Managing order status and stock<\/a><\/li><\/ul><li><a href=\"#troubleshooting-and-maintaining-your-gateway\">Troubleshooting and maintaining your gateway<\/a><ul><li><a href=\"#common-issues-and-fixes\">Common issues and fixes<\/a><li><a href=\"#keeping-the-gateway-updated\">Keeping the gateway updated<\/a><\/li><\/ul><li><a href=\"#conclusion\">Conclusion<\/a><\/li><\/ul>","tenweb_blog_competitor_type":"","tenweb_blog_competitor_names":"","tenweb_blog_twb_version":0,"tenweb_blog_type":""},"categories":[506],"tags":[],"class_list":["post-39388","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add a Custom Payment Method in WooCommerce - 10Web<\/title>\n<meta name=\"description\" content=\"Learn how to add a custom payment method in WooCommerce. Set up custom gateways and manage orders, for a smooth checkout process.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add a Custom Payment Method in WooCommerce\" \/>\n<meta property=\"og:description\" content=\"Learn how to add a custom payment method in WooCommerce. Set up custom gateways and manage orders, for a smooth checkout process.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/\" \/>\n<meta property=\"og:site_name\" content=\"10Web - Build &amp; Host Your WordPress Website\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/10Web.io\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-22T13:46:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1569\" \/>\n\t<meta property=\"og:image:height\" content=\"880\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tigran Nazaryan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@10Web_io\" \/>\n<meta name=\"twitter:site\" content=\"@10Web_io\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tigran Nazaryan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Add a Custom Payment Method in WooCommerce - 10Web","description":"Learn how to add a custom payment method in WooCommerce. Set up custom gateways and manage orders, for a smooth checkout process.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/","og_locale":"en_US","og_type":"article","og_title":"How to Add a Custom Payment Method in WooCommerce","og_description":"Learn how to add a custom payment method in WooCommerce. Set up custom gateways and manage orders, for a smooth checkout process.","og_url":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/","og_site_name":"10Web - Build &amp; Host Your WordPress Website","article_publisher":"https:\/\/www.facebook.com\/10Web.io\/","article_published_time":"2024-05-22T13:46:47+00:00","og_image":[{"width":1569,"height":880,"url":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg","type":"image\/jpeg"}],"author":"Tigran Nazaryan","twitter_card":"summary_large_image","twitter_creator":"@10Web_io","twitter_site":"@10Web_io","twitter_misc":{"Written by":"Tigran Nazaryan","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#article","isPartOf":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/"},"author":{"name":"Tigran Nazaryan","@id":"https:\/\/10web.io\/blog\/#\/schema\/person\/9466e64f67fc213397b384bbe3af3bd0"},"headline":"How to Add a Custom Payment Method in WooCommerce","datePublished":"2024-05-22T13:46:47+00:00","dateModified":"2024-05-22T13:46:47+00:00","mainEntityOfPage":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/"},"wordCount":1686,"commentCount":0,"publisher":{"@id":"https:\/\/10web.io\/blog\/#organization"},"image":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#primaryimage"},"thumbnailUrl":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg","articleSection":["WooCommerce"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/","url":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/","name":"How to Add a Custom Payment Method in WooCommerce - 10Web","isPartOf":{"@id":"https:\/\/10web.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#primaryimage"},"image":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#primaryimage"},"thumbnailUrl":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg","datePublished":"2024-05-22T13:46:47+00:00","dateModified":"2024-05-22T13:46:47+00:00","description":"Learn how to add a custom payment method in WooCommerce. Set up custom gateways and manage orders, for a smooth checkout process.","breadcrumb":{"@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#primaryimage","url":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg","contentUrl":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2024\/04\/add_custom_payment_method_in_woocommerce.jpg","width":1569,"height":880,"caption":"How to Add a Custom Payment Method in WooCommerce"},{"@type":"BreadcrumbList","@id":"https:\/\/10web.io\/blog\/how-to-add-a-custom-payment-method-in-woocommerce\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/10web.io\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Add a Custom Payment Method in WooCommerce"}]},{"@type":"WebSite","@id":"https:\/\/10web.io\/blog\/#website","url":"https:\/\/10web.io\/blog\/","name":"10Web Blog - Build & Host Your WordPress Website","description":"10Web is an All-in-One Website Building Platform, offering Managed WordPress Hosting on Google Cloud, Beautiful Templates, Premium Plugins and Services.","publisher":{"@id":"https:\/\/10web.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/10web.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/10web.io\/blog\/#organization","name":"10Web","url":"https:\/\/10web.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/10web.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2025\/04\/Logo-768x686-1.png","contentUrl":"https:\/\/10web.io\/blog\/wp-content\/uploads\/sites\/2\/2025\/04\/Logo-768x686-1.png","width":768,"height":686,"caption":"10Web"},"image":{"@id":"https:\/\/10web.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/10Web.io\/","https:\/\/x.com\/10Web_io","https:\/\/www.instagram.com\/10web.io\/","https:\/\/www.linkedin.com\/company\/10web\/mycompany\/","https:\/\/www.youtube.com\/c\/10Web"]},{"@type":"Person","@id":"https:\/\/10web.io\/blog\/#\/schema\/person\/9466e64f67fc213397b384bbe3af3bd0","name":"Tigran Nazaryan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/10web.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ce2393558e7591a237212f11acac58fb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce2393558e7591a237212f11acac58fb?s=96&d=mm&r=g","caption":"Tigran Nazaryan"},"description":"Tigran Nazaryan is an experienced science and technology professional. After seeing great potential in the automation of web development, he co-founded and became CInO of 10Web. Tigran is passionate about creating solutions to bring AI automation into web development and turning great ideas into powerful technological achievements.","sameAs":["https:\/\/www.linkedin.com\/in\/tnazaryan\/"],"url":"https:\/\/10web.io\/blog\/author\/tigran\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/posts\/39388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/comments?post=39388"}],"version-history":[{"count":0,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/posts\/39388\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/media\/34983"}],"wp:attachment":[{"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/media?parent=39388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/categories?post=39388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/10web.io\/blog\/wp-json\/wp\/v2\/tags?post=39388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}