PayPal IPN无法连接并取消重复计费

4

我需要帮助理解如何在用户通过PayPal取消重复付款时将用户标记为已取消。

通知控制器:

 def create
    params.permit! # Permit all Paypal input params
    #query = params
    puts "in method*************************************"   
    #query[:cmd] = "_notify-validate"
    #if  params[:txn_type] == 'subscr_cancel'
    #   user_subscription = Subscription.find_by(paypal_customer_token: params[:payer_id])
        #   user_subscription.update_column("cancelled",1) if user_subscription.present?
    #els
    if  params[:txn_type] == 'recurring_payment_profile_cancel'
      user_subscription = Subscription.find_by(paypal_recurring_profile_token: params[:recurring_payment_id])
      user_subscription.update_column("cancelled",1) if user_subscription.present?
    end
    render :text => 'OK'
  end
end
1个回答

2
嗯,我认为您需要取消注释您已经注释的行,类似于这样:
  if  params[:txn_type] == 'subscr_cancel'
   user_subscription = Subscription.find_by(paypal_customer_token: params[:payer_id])
   user_subscription.update_column("cancelled",1) if user_subscription.present?
  end

我正在使用PHP API,在用户取消订阅时出现了"subscr_cancel"。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接