I have read many posts about the problems of Paypal and checkout complete in Commerce, but I can't seem to get this simple thing to work.

When an order is completed I want to run a custom function. I have tried both hook_commerce_payment_order_paid_in_full and hook_commerce_checkout_complete - but neither seem to fire when paid through Paypal WPS. I am receiving IPN callback from Paypal fine, and it is updating the order status after adding in some custom rules as seen here: Is this normal to have Drupal Commerce stuck in PENDING status after a completed paypal payment?

I have also tried adding a custom action to be used in rules - but unsure how to get the corresponding order id in this case?

The only way I have got it to work is to use hook_preprocess_html which checks for the checkout/complete page, gets the order id from arg(1), and runs it all there, which is obviously very dirty.

Any help on this would be greatly appreciated.

  • Are you sure it isn't an error in your custom code? The paid in full hook should be fired regardless of when the IPN is received, i.e. before or after the customer returns from PayPal - unless it's an authorization only or a pending e-Check transaction. – Ryan Szrama Sep 10 '14 at 3:40
  • @RyanSzrama I've just tried the following the see if it does anything - it does nothing. What am I missing? function my_module_commerce_payment_order_paid_in_full($transaction){ print_r($transaction); die(); } – Chris Sep 10 '14 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.