function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TJMeadowsTJMeadows 

PaymentConnect Terminal not keeping query parameters

Hello community.

I'm trying to include PaymentConnect's payment terminal into a custom order wizard and have been following the supplied user guide.
Here's a snippet of the javascript to direct the user to the terminal:
goToPayment = function(){
	        	window.location = '/apex/pymt__PaymentTerminal?' +
	        		'csid={!quickOrder.BillToContactId}' +
	        		'&cancelURL=' + window.location +
	        		'&finishURL=' + window.location;
       		}

The issue I'm running into is that after clicking the Review Transaction button, all of the query parameters disappear. So after confirming the transaction on the next page, there is no finishURL to send the user back to the custom order wizard.

User-added image

User-added image

Has anyone else run into this issue?
Best Answer chosen by TJMeadows
sathishkumar periyasamysathishkumar periyasamy
@TJMeadows, we are using linvio payment terminal without any issue. Please find below code which we are using

terminalURL = '/apex/pymt__paymentterminal?';
                terminalURL = terminalURL+'id='+strPaymentId;
                terminalURL = terminalURL+'&cancelURL='+EncodingUtil.urlEncode(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/cancelPage?Id='+opportunityID,'UTF-8');
                terminalURL = terminalURL+'&finishURL='+EncodingUtil.urlEncode(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/confirmationPage?Id='+opportunityID+'&paymentid='+strPaymentId,'UTF-8');

Plese let me know if you have any question.

All Answers

VineetKumarVineetKumar
Well the value is not getting lost actually, it still remains in the view state.
But if you try to refer in the javascript andd the parameter value, you may not get it.
Try referencing the value as : {!$CurrentPage.parameters.[nameOfparam]}

Well, as a best practice why don't you save the value in some hidden variable and try using that.
TJMeadowsTJMeadows
Thanks VineetKumar for the response. My issue isn't that I can't retrieve the parameters but that this Linvio packaged PaymentTerminal doesn't use finishURL to redirect the user to said URL. The goToPayment method sends the user from my page to this terminal and must use query parameters because: 1. Viewstate and input fields are unique to the running page. We are leaving my page, thus clearing the state at which the page was in. 2. PaymentConnect user guide says it needs to be. That's how when arriving to the PaymentTerminal from any origin, they set the stage for the transaction. The expected functionality is that after the payment in the terminal the user is returned to my page. I'm wondering if the finishURL is malformed and being ignored. The window.location is just for the example and not the real URLs I'm using. For further debugging, I'll need to see if the PaymentTerminal is using js or its controller to handle redirects.
sathishkumar periyasamysathishkumar periyasamy
@TJMeadows, we are using linvio payment terminal without any issue. Please find below code which we are using

terminalURL = '/apex/pymt__paymentterminal?';
                terminalURL = terminalURL+'id='+strPaymentId;
                terminalURL = terminalURL+'&cancelURL='+EncodingUtil.urlEncode(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/cancelPage?Id='+opportunityID,'UTF-8');
                terminalURL = terminalURL+'&finishURL='+EncodingUtil.urlEncode(URL.getSalesforceBaseUrl().toExternalForm()+'/apex/confirmationPage?Id='+opportunityID+'&paymentid='+strPaymentId,'UTF-8');

Plese let me know if you have any question.
This was selected as the best answer
TJMeadowsTJMeadows
Thanks SathishKumar. As I thought my finishURL was malformed and your code snippet helped confirm that since my method didn't include any encoding.