In my Drupal Commerce site, I redirect to a local payment API with a custom module after the user selected the local payment gateway in the review order page. The users enter username and password in the local payment website; if the user is authenticated successfully, the payment gateway server redirects back to my localhost at http://localhost/commerce/sites/all/modules/paymentgateway/CheckoutComplete.php.

In that page, the pay button exists; the user has to click the pay button to finish the payment transaction. After finishing payment, I want the server to redirect to Drupal Commerce's checkout complete page, e.g. http://localhost/commerce/checkout/93/complete.

How do I redirect to this link? Do I have to implement a hook?

1 Answer 1


enter image description here

In this payment structure with local payment gateway, I have to pass product item lists, return url and cancel url to local payment gateway through drupal commerce’s Local Payment Module. If detail information of this payment is returned, in that page I redirect to the this link http://localhost/checkoutComplete/completeCheckout .


function checkout_complete_loadAllrecord()
    //current orderId
    $paraorder = variable_get("order", "");    
    $order = commerce_order_status_update($paraorder, 'checkout_complete');

    //assign order status to checkout_complete
    $order->status = "checkout_complete";

   //calling this method order status will be changed to "Checkout_complete", this method will fire commerce_checkout_rule()
   //In commerce_checkout_rule(), we can send email to client to notify checkout is complete.

    //redirect to order completed page



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.