[ic] custom payment module

Lyn St George lyn at zolotek.net
Tue Sep 13 20:14:54 UTC 2011

On Monday 12 September 2011 17:08:37 Dan Bergan wrote:
> On Mon, Sep 12, 2011 at 7:26 AM, Lyn St George <lyn at zolotek.net> wrote:
> > On Sunday 11 September 2011 20:48:40 Dan Bergan wrote:
> >> I am creating a custom payment module (using Lyn's PayPal Express and
> >> WorldPay modules as starting points.)  I'm having a strange problem
> >> and I can't figure out what I'm doing wrong.
> >> 
> >> A user is sent to the payment provider's web site to enter their
> >> billing address and payment info. After the credit card is processed,
> >> the payment site posts data back to interchange (which I save to the
> >> database), then redirects the user back to my ic site where I submit
> >> the order, the payment module grabs the previously saved information
> >> (billing address, payment result) and saves that information to the
> >> user's Values space.
> >> 
> >> All this seems to work just fine -- log_transaction saves the order
> >> just fine, and the customer information in the Values space (that I
> >> retrieved in the payment module) are available, but in the receipt
> >> page, email receipt and my order report, those values are not present.
> >> 
> >> Is that expected behavior, or I am making a mistake somewhere?
> >> 
> >> Thanks -
> >> Dan Bergan
> > 
> > The most likely scenario is that you're dropping the session at the point
> > where you change to send the emails and display the receipt. Check this
> > first by displaying the session id on the page at various points.
> Values that were set before the payment module and Scratch values that
> were set inside the payment module are available at every step, so I
> think the session is being maintained.
> I did some digging into the code, and I found that in route_order in
> Order.pm, and I see near the beginning:
> my $value_save = { %{$::Values} };
> And then near the end of the function:
> $Vend::Interpolate::Values = $::Values = $value_save;
> So, am I right in thinking that saving data to the values space in an
> order route won't work for me?  I assume that I will have to put my
> payment processing outside of the order route:
> [charge route="mypaymentroute"]
> and then submit the order after that.
> Dan

The values hash should be available if it's retrieved at the point that you 
want to use it - I'm not totally clear on the precise process happening here 
but perhaps you have an extra step before using the retrieved values? Losing 
the session is really the only way you're going to lose any values in the 
session in this procedure, so perhaps you could double check that with 
explicit debugging points?

Lyn St George

More information about the interchange-users mailing list