[ic] Payment gateway : how to update database without clicking?

ffire interchange-users@icdevgroup.org
Wed Jul 10 17:31:01 2002


I'm using WorldPay (I *had* to use it, anyone successful so far?) as 
my payment gateway.  My question is, after the payment gateway 
returns the status (success/failure) and calls my IC page as a 
callback, is there a way to update the database without requiring 
users to "click" on a page?

The flow is:

1) from checkout page, user clicks "submit"
2) save all orders and userdb updates info into transactions and 
userdb tables, tagging a flag in transactions table, 
"wp_payment_status", to be "pending_payment" (by setting 
"Save_database").
3) link to payment gateway (ie, WorldPay); make payment.
4) callback from payment gateway back to my receipt page, which will 
then update the transactions table's "wp_payment_status" field to 
"Success".

I searched the archives, and found a suggestion from Joachim (see 
below).  However, he's using "mv_order_receipt" as a trigger to save 
into the transactions, userdb and orderlines tables.  By this point 
of time, I do not need to re-save all these info again, instead I 
only want to update the "wp_payment_status" field to "Success".  Is 
there a way I can do that?

I've tried this code in my receipt page:

[sql interpolate=1]
    update transactions set wp_payment_status='Success' where 
code=='[value my_order_number]'
[/sql]

where my_order_number is returned by the payment gateway (passed from 
my checkout page).

I tested the above codes separately without going through WorldPay, 
and it worked.  But when called from WorldPay as a callback, it 
seemed to be running from WorldPay (url still pointing to WorldPay), 
thus couldn't work (ie, table not updated).  I printed out 
[value my_order_number] on that page, and the value is correctly 
returned from WorldPay.  Looks as if mysql is rejecting updates from 
servers other than mine(?)  Just my deduction, any pointers?




I quote Joachim Leidinger (Thu Feb 14 16:14:01 2002):
> If the callback-IC-Page has the name like 
> "CallBackfromtheGateway.html",
> you can finish the order with You can submit the order with 
>
> [if scratch return-message-of-the-gateway =~ /success/]
> [seti url][area href=process form="
> mv_todo=submit
> mv_order_route=log main copy_user
> mv_order_report=ord/report
> mv_order_receipt=ord/receipt
> "][/seti]
> [bounce href="[scratch url]"]
> [/tmp]
> [/if] 
>
> by IC and IC finish the order without any clicks of process.
> (Big thanks to Racke for the hint!)

You can find this post at:
http://interchange.redhat.com/pipermail/interchange-users/2002-February/017800.html