Redirect to Thank you Page & UpdateOrderPaymentResult

Antonio Developer asked on July 4, 2017 09:58

Hello everybody

Iam still stuck on my custom gateway provider and need help in my last steps: I built a Dummy PaymentService (ascx) and display some Paymentdata like name of buyer, Total price and order ID. On this page. I can fake a "Payment Completed" with a button click. After click I will give Kentico the Notification that the payment was successful and redirect the user to a Thankyou Page.

I tried the following code after my URLHelper.Redirect in ProcessPayment():

this.PaymentResult.PaymentIsCompleted = true;
UpdateOrderPaymentResult();

But Kentico still displays that the Order is not paid.. How can I do this? Iam confused with the Payment Notification Page and PaymentResults..

Thanks

Recent Answers


Anton Grekhovodov answered on July 4, 2017 12:09

Hi,
Have you created statuses for orders? I think you need to add some statuses like New, Payment Failed and Payment received and populate this.PaymentResult.PaymentStatusValue property with Payment received status

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on July 4, 2017 16:43

You should start here: https://devnet.kentico.com/articles/developing-custom-payment-gateway It is made for version 7, but it is valid. Some methods probably have changes but the principle is the same. You can download the example code as well.

Kentico has a default PN page for paypal \CMS\CMSModules\Ecommerce\CMSPages\PayPalIPN.aspx.cs You can find the PN example on GitHub It should give you the idea how to work with paymentinfo.

If you want to make a redirect inside process payment method:

                // Redirect using javascript 
                var paymentGatewayUrl = "your url";
                ScriptHelper.RegisterClientScriptBlock(PaymentDataForm.Page, typeof(string), "", "<script type='text/javascript'>window.onload = function(){ window.document.forms[0].action='" + paymentGatewayUrl + "';window.document.forms[0].submit(); }; </script>");
1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.