I have a content type, and with the help of the UC node checkout module, I am able to successfully add the content to cart once it is created by the user. When the user checked out and had made a successful payment, I want to create another node of another content type.

function gy_mod_uc_checkout_complete($order, $account) { 
  if ($order->order_status == 'payment_received') { 

The above is not getting fired; I always get it as "in_checkout." I tried doing it using the Paypal sandbox.

Does anyone have a suggestion on how I should write the code I need?

  • The order status is still in pending(post_checkout) once the user completes the payment on paypal. How can i do something on successfull payments? instead of checking the paypal account manually and verify if the payment is successful and change the state as payment_received for the order ?
    – Satya
    Commented Sep 23, 2011 at 13:01

1 Answer 1


Looks like hook_uc_checkout_complete() is called while the order is still in "in_checkout."

You might want to consider using Ubercart's Conditional actions module and add an action for "Trigger: Customer completes checkout"; it allows you to execute actions based on a range of conditions. You can then either execute custom PHP code to create the node, or implement the hook_ca_action() (see "ubercart/ca/ca.ca.inc" for reference).

As to how to programmatically create a node, you can either use node_save() or drupal_execute(). There's quite a few tutorials around that you can use as guidance.

  • Worked for me. TQ
    – Satya
    Commented Sep 28, 2011 at 17:39

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.