PayPal付款完成后更新数据库
购买完成后插入交易没有任何问题。
问题是我如何更新数据。
MySQL 表: 用户:
id | email | credit
----------------------------
1 [email protected] 2
2 [email protected] 1
PayPal IPN:
$p = new paypal_class;
if ($p->validate_ipn()) {
if($p->ipn_data['payment_status'] == 'Completed') {
$db->query("UPDATE users SET credit='". $p->ipn_data['custom'] . "' WHERE email='" . $p->ipn_data['payer_email'] . "'");
}
}
PayPal 按钮 ->隐藏(自定义)= 5 学分
贝宝按钮 -> 隐藏(自定义)= 10信用
如果用户1
想要充值他们的信用, ,剩余的信用(2)+PayPal(5)= 7。
而是将积分(2)替换为(5)。
ive got no problem with inserting the transaction after puchased is completed.
the problem is how do i update the data.
MySQL table:
USERS:
id | email | credit
----------------------------
1 [email protected] 2
2 [email protected] 1
PayPal IPN:
$p = new paypal_class;
if ($p->validate_ipn()) {
if($p->ipn_data['payment_status'] == 'Completed') {
$db->query("UPDATE users SET credit='". $p->ipn_data['custom'] . "' WHERE email='" . $p->ipn_data['payer_email'] . "'");
}
}
PAYPAL BUTTON -> hidden(custom) = 5 credit
PAYPAL BUTTON -> hidden(custom) = 10 credit
if user 1
want to topup their credit, the remaining his credit (2)+PayPal(5)= 7.
instead replacing credit(2) to (5).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保credit是数字类型字段,然后:
Ensure that credit is a numeric type field, then: