Ecommerce Form/Payment Gateway - passing a dynamic value through the process


(Steve Scamp) #1

We're setting up a donation form in our Matrix system, using an Ecommerce Form and a SecurePay Direct Post Payment Gateway. (This will be our first foray into the use of Matrix's Ecommerce functionality.) It's going to be used as part of an email campaign to elicit donations from people in our 'Contacts' database. Each person in the database has a unique ID there.

 

The idea is to provide in the campaign email a link to a URL for the form, a URL that would include the unique ID somehow. So when the transaction is completed, the unique ID helps to speed up considerably the process of finding each contact's record in the database.

 

So we're looking to somehow pass each contact's unique ID as a value through the whole transaction process, 

 

I was hoping to add the unique ID as part of the URL, e.g. something like http://payments.site.com.au/form?uniqueid=456UIJB, and then use a little Javascript to dynamically assign the unique ID as the value of a hidden field, which after a successful transaction then gets passed through and included in the email that goes to the database administrator. I've done something similar and reasonably successfully with a Custom Form with no Confirmation page (although I'll concede that it's not bulletproof).

 

However I find that this idea won't work with an Ecommerce form, for the following reasons:

  • An Ecommerce form has to have a Confirmation page as part of the process (unlike my Custom Form, which doesn't have one).
  • An Ecommerce form calls on the separate Payment Gateway form between its Confirmation and Receipt stages. The extra string in the URL representing the Contact ID disappears when the Payment Gateway form is displayed, and I can't figure out a way of getting the Contact ID to 'carry across' to the new form and come out in the resulting Recipient Email, the email that goes to the database admin.

I've tried a few edits in the code of the Confirmation page in particular, but to no avail.

 

So I was just wondering, has anybody come up against this kind of requirement before? If so, were you able to solve it, and how? Did you use some other method of dynamically passing through a value that you don't want the submitter of the form to see or enter, and that can't be added into the form 'manually'? If anybody would like to share the details of a solution, I would love to see them!

 

Sorry, this is probably not a very good explanation of the issue. But many thanks for any help or suggestions.

 

Cheers,

 

Steve


(Bart Banda) #2

Hey steve,

you should just be able to create a new text field and put %globals_get_uniqueid% as the default value in it. Then just hide the text field with CSS or hardcode it and make it a type="hidden" field. That should then be retained through the ecommerce form and the payment gateway just like any other field on the form. 


(Steve Scamp) #3

Hey steve,

you should just be able to create a new text field and put %globals_get_uniqueid% as the default value in it. Then just hide the text field with CSS or hardcode it and make it a type="hidden" field. That should then be retained through the ecommerce form and the payment gateway just like any other field on the form. 

 

Hi Bart,

 

Thanks very much for the reply. 

 

Since I put up this post I've managed to use a bit of JavaScript to extract the relevant string from the form page URL and stick it in a hidden field. Once I managed to solve some clashes it was having with some form validation scripts (of course) it then passed the value through the whole form/gateway process quite nicely, and appears in the auto-email that goes to our finance department.

 

But... hmmm! Maybe, thanks to your explanation, I'm actually starting to understand what that global keyword can actually do. So if the name-value pair that I want to extract from the URL looks like reid=123456-G, then I'd use the global keyword %globals_get_reid% in my hidden field to extract it.

 

Am I right in thinking that's how %globals_get_<variable>% works? Or is there more to it?

 

Thanks again, Bart.

 

(P.S. Incidentally, why were you on the forums at the unearthly hour of 10.10pm last night?)


(Bart Banda) #4

Good stuff Steve, yes, that's exactly how that keyword can be used, you can also use %globals_post_somevalue% to do the same thing with POST values, more info here: http://manuals.matrix.squizsuite.net/concepts/appendices/global-keyword-replacements#HTTP-Get-Variable

 

Glad to hear it worked for you.

 

 

(P.S. Incidentally, why were you on the forums at the unearthly hour of 10.10pm last night?)

 

I'm travelling at the moment (in Hobart) and there wasn't much good on TV in the hotel room so I thought I'd catch up on forum posts :)


(Steve Scamp) #5

Good stuff Steve, yes, that's exactly how that keyword can be used, you can also use %globals_post_somevalue% to do the same thing with POST values, more info here: http://manuals.matrix.squizsuite.net/concepts/appendices/global-keyword-replacements#HTTP-Get-Variable

 

Glad to hear it worked for you.

 

 

 

I'm travelling at the moment (in Hobart) and there wasn't much good on TV in the hotel room so I thought I'd catch up on forum posts :)

 

Ah, it's your week to visit Hobart, is it? Here's hoping you have a good time. (And I hope Adrian and Andrew had a good time during the week they were down there.)

 

Thanks again for the info.