I have the following code in my simple ubercart payment gateway module to redirect it to my merchant payment form after checkout:
$data = array(
'merchantId' => "1",
'amount' => $total,
'orderRef' => $order->order_id,
'currCode' => 608,
'successUrl' => 'http://mydomain.com/cart/checkout/complete',
'failUrl' => 'http://mydomain.com/Fail.html',
'cancelUrl' => 'http://mydomain.com/Cancel.html',
'payType' => 'N',
'lang' => 'E',
'pdesc' => t('You have !num_of_products products in your cart', array('!num_of_products' => count($order->products))),
);
$form['#action'] = 'https://test.mymerchantgateway.com/payment/pay.jsp';
In the code above I can initiate payment successfully. The problem is on how to return to my site and mark the order as complete. After some research, I added “http://mydomain.com/cart/checkout/complete” as the return url to my site but it’s not working.
Any know what is the correct return url in order to mark the ubercart order after checkout as complete?
I am using drupal 6.0
If this is your custom payment module, you have to create your own redirect url
(you can create one for all cases [success, error, cancel] and redirect upon status message returned):
1.Specify a menu callback and a function to catch the POST variables returned by your payment gateway
e.g for module name: uc_mypayment
2.Then you have to implement the callback function which is the one that handles the returned variables:
tweak it according to your gateway protocol.
3.Depending on the status and message you get back, you may redirect to the corresponding status page (i.e success, error, cancel) e.g
Now you can just supply one url for all cases, in this example: cart/mypayment/complete