charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

Hello alll,

Today, i have created the custom payment types using the reference "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' => 'new','action'=>'payment')). But I don't have any idea in shopware 6. 

guide me for the local redirect in shopware6

Tagged:

Comments

  • Michael TelgmannMichael Telgmann ModeratorComments: 987 Received thanks: 281 Member since: June 2014

    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 Michael Telgmann

  • charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

    Hello Michael,

    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 

  • Michael TelgmannMichael Telgmann ModeratorComments: 987 Received thanks: 281 Member since: June 2014

    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

    As you can read here 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. 

    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. 

    Best regards from Schöppingen

    cool Michael Telgmann

    Thanked by 1charles0301
  • charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

    Hello Michael,

    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?

    1) I have created the sample URL by analyzing the PayPal module, I don't know if it's right are not?

    $url = $this->router->generate('custom.plugins.sample.test',['sw-token' => $this->shopToken],UrlGeneratorInterface::ABSOLUTE_URL);

      my module name "swag-sample" controller name "test" and action name "refund"

    2) And then forward to the generated URL by using this? 

    $this->forwardToRoute($url);

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

    Best Regards,

    Charles 

  • Michael TelgmannMichael Telgmann ModeratorComments: 987 Received thanks: 281 Member since: June 2014

    Hello Charles,

    I still don't get why you want to generate an URL on your own Smile For what do you need an own controller?

    Best regards from Schöppingen

    cool Michael Telgmann

  • charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

    Hello Michael, 

     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?

     

  • Michael TelgmannMichael Telgmann ModeratorComments: 987 Received thanks: 281 Member since: June 2014

    Hello Charles,

    once again an example from our PayPal Plugin Smile We extended the confirm form, to send additional data if the customer submits the order: 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: https://github.com/shopwareLabs/SwagPayPal/blob/master/src/Payment/PayPalPaymentHandler.php#L96

    I don't see why you would need an own controller Wink Hope this helps

    Best regards from Schöppingen

    cool Michael Telgmann

    Thanked by 1charles0301
  • charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

    Hello Michael,

    Thanks for the help it's really worked Smile, 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.

     

    Best Regards,

    Charles

  • Michael TelgmannMichael Telgmann ModeratorComments: 987 Received thanks: 281 Member since: June 2014

    Hey Charles,

    there is currently no way for a customer comment. Just not implemented yet Wink 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 https://issues.shopware.com/?projects=NEXT

    Viele Grüße aus Schöppingen

    cool Michael Telgmann

  • charles0301charles0301 MemberComments: 7 Received thanks: 0 Member since: January 8

    Hello 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 Wink, why I have not got any order mail. just give me some hint to receive the order mail. 

    have a good day!Smile

     

    Best Regards,

    Charles  

  • Moritz NaczenskiMoritz Naczenski AdministratorsComments: 7830 Received thanks: 2292 Member since: September 2013

    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

    Thanked by 1charles0301
Sign In or Register to comment.