# How to Redirect from PaymentService file to My Controller in shopware6

**URL:** <https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176>\
**Category:** Programming (EN)\
**Tags:** datepicker\
**Created:** [27. Juni 2019 um 08:08 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176 "2019-06-27T08:08:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [27. Juni 2019 um 08:08 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/1 "2019-06-27T08:08:09Z")

</div>

Hello alll,

Today, i have created the custom payment types using the reference “[Shopware 6: Payment plugin](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/payment-plugin?category=shopware-platform-dev-en/how-to)”

And Now I want to redirect the payment service file to my new controller file. In shopware 5 we are using $this-\>router-\>assemble(array(‘controller’&nbsp;=\> ‘new’,‘action’=\>‘payment’)). But I don’t have any idea in shopware 6.&nbsp;

guide me for the local redirect in shopware6

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [27. Juni 2019 um 08:15 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/2 "2019-06-27T08:15:57Z")

</div>

Hello Charles,

what do you want to achieve? With the async interface you have the possibility to redirect to your payment provider and the payment provider redirects to the automatically generated return-URL, if you provided it to the payment provider. Normally there is no need for an own controller.

Best regards from Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [27. Juni 2019 um 08:57 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/3 "2019-06-27T08:57:05Z")

</div>

Hello Michael,

Thanks for the reply, I have done the AsynchronousPaymentHandlerInterface payment but how to send the values in&nbsp;the post fields with the URL to payment&nbsp;provider and How I can&nbsp;generate the return\_URL. I have searched a lot but can’t find any document to generate the return-URL&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [27. Juni 2019 um 09:38 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/4 "2019-06-27T09:38:11Z")

</div>

Hello Charles,

the payment process in Shopware 6 is explained here: [https://docs.shopware.com/en/shopware-platform-dev-en/internals/core/checkout-process/payment](https://docs.shopware.com/en/shopware-platform-dev-en/internals/core/checkout-process/payment)

As you can read here [Shopware 6: Payment plugin](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/payment-plugin?category=shopware-platform-dev-en/how-to) in the code example, the AsynchronousPaymentHandlerInterface gets an AsyncPaymentTransactionStruct in the pay method. This object contains the return URL. So no need to generate it on your own.&nbsp;

Now you should do your request to the payment provider API to give it all the information about the payment. You can find an example in our PayPal plugin: [https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Payment/PayPalPaymentHandler.php#L111](https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Payment/PayPalPaymentHandler.php#L111)  
Normally you will get back a redirect URL from your payment provider, so you just need to return a RedirectResponse with the given redirect URL.

If the customer now accepts the payment, you will automatically will be redirected to the shop, and the finalize method is called. Now you can do stuff to finish your payment.&nbsp;

Best regards from Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [27. Juni 2019 um 13:00 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/5 "2019-06-27T13:00:22Z")

</div>

Hello Michael,

Thanks for the reference you are provided it’s really helpful. As you said I have got the return\_URL from the&nbsp;AsyncPaymentTransactionStruct object. I have the Following questions based on generating the URL?

1. I have created the sample URL by analyzing the&nbsp;PayPal module, I don’t know if it’s right are not?

&nbsp; my module name " **swag-sample**" controller name " **test**" and action name " **refund**"

1. And then forward to the generated URL by using this?&nbsp;

Please guide me to proceed further, I would be very grateful

Best Regards,

Charles&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [27. Juni 2019 um 13:13 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/6 "2019-06-27T13:13:56Z")

</div>

Hello Charles,

I still don’t get why you want to generate an URL on your own&nbsp; ![Smile](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/bac5f5766b6a20565a8fb995345b4e41d24daac0.png "Smile")&nbsp;For what do you need an own controller?

Best regards from Schöppingen

&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [27. Juni 2019 um 13:22 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/7 "2019-06-27T13:22:01Z")

</div>

Hello&nbsp;Michael,&nbsp;

&nbsp;I&nbsp;wanted to redirect the payment in the form method using twig file. so I have created the controller file. Because of shopware 6&nbsp; Redirect&nbsp;the data in GET method. Are any other methods&nbsp;to send the data with the post method in shopware6?

&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [27. Juni 2019 um 14:07 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/8 "2019-06-27T14:07:37Z")

</div>

Hello Charles,

once again an example from our PayPal Plugin&nbsp; ![Smile](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/bac5f5766b6a20565a8fb995345b4e41d24daac0.png "Smile")&nbsp;We extended the confirm form, to send additional data if the customer submits the order:&nbsp;[SwagPayPal/index.html.twig at master · shopwareLabs/SwagPayPal · GitHub](https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Resources/views/storefront/page/checkout/confirm/index.html.twig)  
This values are now available in the PaymentHandler, e.g:&nbsp;[https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Payment/PayPalPaymentHandler.php#L96](https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Payment/PayPalPaymentHandler.php#L96)

I don’t see why you would need an own controller&nbsp; ![Wink](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/b3785da0cbf2c8566cb535dcf55b2730b5224899.png "Wink")&nbsp;Hope this helps

Best regards from Schöppingen

&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [28. Juni 2019 um 09:51 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/9 "2019-06-28T09:51:26Z")

</div>

Hello Michael,

Thanks for the help it’s really worked ![Smile](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/bac5f5766b6a20565a8fb995345b4e41d24daac0.png "Smile"),&nbsp;Now I&nbsp;have Another doubt about shopware 6. In shopware 5 we are showing the customer comments from the " **customercomment**"&nbsp;&nbsp;column in **s\_order** table. But in shopware 6 there is no such a column for displaying the comments to the customer. if it is removed in shopware 6&nbsp;(or) it may comes with&nbsp;shopware 6 normal release.

&nbsp;

Best Regards,

Charles

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [28. Juni 2019 um 11:52 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/10 "2019-06-28T11:52:53Z")

</div>

Hey Charles,

there is currently no way for a customer comment. Just not implemented yet&nbsp; ![Wink](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/wink.png "Wink")&nbsp;But to be honest, I also don’t no, if there are plans to do so. But you could create a ticket for that, so that we are aware of your need here&nbsp;[Shopware Issuetracker](https://issues.shopware.com/?projects=NEXT)

Viele Grüße aus Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![charles0301](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/charles0301/32/8085_2.png) [@charles0301](https://forum.shopware.com/u/charles0301)\
**Post date:** [2. Juli 2019 um 12:39 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/11 "2019-07-02T12:39:53Z")

</div>

Hello&nbsp;Michael Telgmann,

Thanks a lot for the help you have done, I have completed the payment by half of the way, but order mail is not received yet from the shop system (shopware6) for every order. I have added the sales channel in the email settings ( **Setting-\>Email template** ). But I am still wondering&nbsp; ![Wink](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/b3785da0cbf2c8566cb535dcf55b2730b5224899.png "Wink"), why I have not got any order mail. just give me some hint to receive the order mail.&nbsp;

have a good day! ![Smile](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/bac5f5766b6a20565a8fb995345b4e41d24daac0.png "Smile")

&nbsp;

Best Regards,

Charles&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [2. Juli 2019 um 12:48 UTC](https://forum.shopware.com/t/how-to-redirect-from-paymentservice-file-to-my-controller-in-shopware6/60176/12 "2019-07-02T12:48:12Z")

</div>

Hello Charles,

fas far as I know, this process isn’t implemented yet - so you won’t get any order confirmation, because this is not completely implemented.

We are still working on the mail system.

Moritz
