{"id":105952,"date":"2017-12-22T14:29:12","date_gmt":"2017-12-22T14:29:12","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=105952"},"modified":"2024-02-16T13:34:11","modified_gmt":"2024-02-16T13:34:11","slug":"redirect-to-third-party-link-after-order-place-magento2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/","title":{"rendered":"Redirect to Third Party Link after Order Placement in Magento 2"},"content":{"rendered":"\n<p>If in your Magento, you have created a custom payment method, and using payment API for the transaction, and want to redirect to custom url after order place to complete transaction then, you can use following process.<\/p>\n\n\n\n<p>Here is a blog to create custom payment method in Magento 2.<br><a href=\"https:\/\/webkul.com\/blog\/create-custom-payment-method-magento2\/\">Blog link<\/a><br>Now in payment method file add following code:<\/p>\n\n\n\n<p>file path:\u00a0app\/code\/Test\/Testpayment\/view\/frontend\/web\/js\/view\/payment\/method-renderer\/testpayment.js<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/*browser:true*\/\n\/*global define*\/\ndefine(\n    &#091;\n        &#039;ko&#039;,\n        &#039;jquery&#039;,\n        &#039;Magento_Checkout\/js\/view\/payment\/default&#039;,\n        &#039;Test_Testpayment\/js\/action\/set-payment-method-action&#039;\n    ],\n    function (ko, $, Component, setPaymentMethodAction) {\n        &#039;use strict&#039;;\n        return Component.extend({\n            defaults: {\n                redirectAfterPlaceOrder: false,\n                template: &#039;Test_Testpayment\/payment\/testpayment&#039;\n            },\n            afterPlaceOrder: function () {\n                setPaymentMethodAction(this.messageContainer);\n                return false;\n            }\n        });\n    }\n);<\/pre>\n\n\n\n<p>Now, create set payment method action file:<\/p>\n\n\n\n<p>file path:\u00a0app\/code\/Test\/Testpayment\/frontend\/web\/js\/action\/set-payment-method-action.js<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/*jshint jquery:true*\/\ndefine(\n    &#091;\n        &#039;jquery&#039;,\n        &#039;Magento_Checkout\/js\/model\/quote&#039;,\n        &#039;Magento_Checkout\/js\/model\/url-builder&#039;,\n        &#039;mage\/storage&#039;,\n        &#039;Magento_Checkout\/js\/model\/error-processor&#039;,\n        &#039;Magento_Customer\/js\/model\/customer&#039;,\n        &#039;Magento_Checkout\/js\/model\/full-screen-loader&#039;\n    ],\n    function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) {\n        &#039;use strict&#039;;\n        return function (messageContainer) {\n            $.mage.redirect(url); \/\/url is your url\n        };\n    }\n);<\/pre>\n\n\n\n<p>Here,<\/p>\n\n\n\n<p>In testpayment.js, we define,<\/p>\n\n\n\n<p>redirectAfterPlaceOrder : false, it means we set default redirection to false.<\/p>\n\n\n\n<p>setPaymentMethodAction: call to set payment method, so, this is your custom file and when your custom payment is got selected then your set-payment-action file get called.<\/p>\n\n\n\n<p>In&nbsp;set-payment-method-action.js file,<\/p>\n\n\n\n<p>we set redirect url to our custom payment method.<\/p>\n\n\n\n<p>After this, flush the cache, and execute the code, and after order place your custom url get executed.<\/p>\n\n\n\n<p>Hope this blog helps you to add functionality in Magento 2.<\/p>\n\n\n\n<p>I hope this blog will help you with Redirect to Third Party Link after Order Placement in Magento 2. You may also check our wide range of best <a href=\"https:\/\/store.webkul.com\/Magento-2.html\">Magento 2 Extensions<\/a>.<\/p>\n\n\n\n<p>Please reach out to our team via a\u00a0<a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\">support ticket<\/a>\u00a0if you have any queries.<\/p>\n\n\n\n<p>Try this and if you have any queries then just comment below \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If in your Magento, you have created a custom payment method, and using payment API for the transaction, and want to redirect to custom url after order place to complete transaction then, you can use following process. Here is a blog to create custom payment method in Magento 2.Blog linkNow in payment method file add <a href=\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":68,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[5959,2070,5958],"class_list":["post-105952","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-custom-payment-method-in-magento2","tag-magento2","tag-order-place-redirect-url"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redirect to Third Party Link after Order Placement in Magento 2<\/title>\n<meta name=\"description\" content=\"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redirect to Third Party Link after Order Placement in Magento 2\" \/>\n<meta property=\"og:description\" content=\"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-22T14:29:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-16T13:34:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Bulbul\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bulbul\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\"},\"author\":{\"name\":\"Bulbul\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/c9c6288b3950490ffdb37cb2a526996e\"},\"headline\":\"Redirect to Third Party Link after Order Placement in Magento 2\",\"datePublished\":\"2017-12-22T14:29:12+00:00\",\"dateModified\":\"2024-02-16T13:34:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\"},\"wordCount\":242,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"custom payment method in magento2\",\"Magento2\",\"order place redirect url\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\",\"url\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\",\"name\":\"Redirect to Third Party Link after Order Placement in Magento 2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2017-12-22T14:29:12+00:00\",\"dateModified\":\"2024-02-16T13:34:11+00:00\",\"description\":\"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redirect to Third Party Link after Order Placement in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/c9c6288b3950490ffdb37cb2a526996e\",\"name\":\"Bulbul\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/37ea7175f5ae6557d01bb38e147f6a02a540714ecdb71770d8ec554d4d34c23f?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/37ea7175f5ae6557d01bb38e147f6a02a540714ecdb71770d8ec554d4d34c23f?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Bulbul\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/bulbul896\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redirect to Third Party Link after Order Placement in Magento 2","description":"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.","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:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/","og_locale":"en_US","og_type":"article","og_title":"Redirect to Third Party Link after Order Placement in Magento 2","og_description":"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.","og_url":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-12-22T14:29:12+00:00","article_modified_time":"2024-02-16T13:34:11+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Bulbul","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Bulbul","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/"},"author":{"name":"Bulbul","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/c9c6288b3950490ffdb37cb2a526996e"},"headline":"Redirect to Third Party Link after Order Placement in Magento 2","datePublished":"2017-12-22T14:29:12+00:00","dateModified":"2024-02-16T13:34:11+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/"},"wordCount":242,"commentCount":5,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["custom payment method in magento2","Magento2","order place redirect url"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/","url":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/","name":"Redirect to Third Party Link after Order Placement in Magento 2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2017-12-22T14:29:12+00:00","dateModified":"2024-02-16T13:34:11+00:00","description":"In this blog we will discuss How to Redirect to Third Party Link after Order Placement in Magento 2.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/redirect-to-third-party-link-after-order-place-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Redirect to Third Party Link after Order Placement in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/c9c6288b3950490ffdb37cb2a526996e","name":"Bulbul","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/37ea7175f5ae6557d01bb38e147f6a02a540714ecdb71770d8ec554d4d34c23f?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/37ea7175f5ae6557d01bb38e147f6a02a540714ecdb71770d8ec554d4d34c23f?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Bulbul"},"url":"https:\/\/webkul.com\/blog\/author\/bulbul896\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=105952"}],"version-history":[{"count":5,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105952\/revisions"}],"predecessor-version":[{"id":422701,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/105952\/revisions\/422701"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=105952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=105952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=105952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}