WooCommerce:将PayPal与notify_URL一起使用 [英] WooCommerce: Use PayPal with notify_URL
问题描述
我正在使用WordPress和WooCommerce建立一个网上商店.我想用它来销售使用某种版权保护的软件.因此,当客户购买软件时,他应该通过电子邮件收到单独的许可证代码.
I am setting up a webshop using WordPress and WooCommerce. I want to use it to sell software which uses some copy protection. So when the customer buys the software he should receive an individual licence code by e-mail.
实际有效的方法:我可以创建一个PayPal立即购买"按钮,在此处输入我的产品ID,然后为许可服务器的URL定义变量"notify_url".效果很好,但我不想使用立即购买"按钮.
What actually works: I can create a PayPal "buy now" button, enter my product ID there and define the variable "notify_url" to the url of my licensing server. This works well but I don't want to use a "buy now" button.
相反,我想将其集成到商店系统WooCommerce中.我设法在那里设置了贝宝标准流程,但是缺少与许可服务器的交互.
Instead I would like to integrate it into the shop system WooCommerce. I managed to setup the PayPal Standard process there but what is missing is the interaction with the licensing server.
所以我的问题是:如何配置WooCommerce,以便PayPal或WooCommerce与我的许可服务器联系以获取购买,产品ID和客户电子邮件地址的信息,以便生成许可证密钥并将其发送给顾客?
So my question is: How can I configure WooCommerce so that my licensing server is contacted by PayPal or WooCommerce with information of the purchase, the product ID and the customers e-mail address in order to generate the license key and send it to the customer?
非常感谢!
推荐答案
您可以使用PayPal IPN
OR
OR
插入WooCommerce挂钩woocommerce_order_status_completed
或woocommerce_payment_complete_order_status
Hook into WooCommerce hook woocommerce_order_status_completed
or woocommerce_payment_complete_order_status
示例:
add_action( 'woocommerce_order_status_completed', 'your_func', 10, 1 );
function your_func($order_id) {
$order = new WC_Order( $order_id );
/* Do Something with order ID or somthing related to it*/
}
这篇关于WooCommerce:将PayPal与notify_URL一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!