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’ => ‘new’,‘action’=>‘payment’)). But I don’t have any idea in shopware 6.
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.
Thanks for the reply, I have done the AsynchronousPaymentHandlerInterface payment but how to send the values in the post fields with the URL to payment provider and How I can generate the return_URL. I have searched a lot but can’t find any document to generate the return-URL
As you can read here Shopware 6: Payment plugin 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.
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
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.
Thanks for the reference you are provided it’s really helpful. As you said I have got the return_URL from the AsyncPaymentTransactionStruct object. I have the Following questions based on generating the URL?
I have created the sample URL by analyzing the PayPal module, I don’t know if it’s right are not?
I wanted to redirect the payment in the form method using twig file. so I have created the controller file. Because of shopware 6 Redirect the data in GET method. Are any other methods to send the data with the post method in shopware6?
Thanks for the help it’s really worked , Now I have Another doubt about shopware 6. In shopware 5 we are showing the customer comments from the " customercomment" 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 (or) it may comes with shopware 6 normal release.
there is currently no way for a customer comment. Just not implemented yet 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 Shopware Issuetracker
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 , why I have not got any order mail. just give me some hint to receive the order mail.