I'm using WooCommerce and Wordpress. I have a custom license key generator, and I'd like it to generate a license key when someone successfully purchases my plugin through WooCommerce.
It seems pretty straight-forward:
- User completes checkout on my site
- User is re-directed to Paypal, where they enter their payment credentials
- Paypal tells my site that the payment is complete
- I hook in to some sort of "payment complete" or "order_complete" WooCommerce action and generate the license.
Here's the problem: I'm really not sure what hook would work well for this. Woocommerce has their entire collection of hooks listed on their site, but virtually no documentation about which is good for what.
Based on just the hook names, I'd think that
woocommerce_payment_complete would be a good action to use. Unfortunately it doesn't seem to be fired at all; some places I've read say that it isn't ever fired.
I've also read something about Paypal IPN, but I don't understand how I could hook in to the notification from that (does that connect to a Woocommerce hook?)
In short, I'd like to generate the license key as soon as the payment has been verified. What do I hook in to in order to achieve this?