1

我堅持讓activemerchants paypal express ipn通知工作。PayPal快速結帳使用activemerchant和ipn

我的工作流程是這樣的:

# authorize the payment user gets redirected.. 
def auth 
    ... 
    gateway.setup_authorization(total_as_cents, setup_authorization_params) 
    ... 
end 

# purchase the authorized sum 
def purchase 
    ... 
    purchase_params = { 
    token: @order.payment_params[:token], 
    payer_id: @order.payment_params[:payer_id], 
    currency: current_tenant.currency.unit, 
    notify_url: paypal_ipn_callback_url 
    } 
    response = gateway.purchase(total_as_cents, purchase_params) 
    ... 
end 

在貝寶的文檔,它說notify_url不贊成他們使用PAYMENTREQUEST_n_NOTIFYURL代替。但我不知道如何告訴我這是我的paypal express網關。

我的ipn回調不會被調用,所以我假設notifyurl參數不再工作。 Paypal處於沙盒模式,但這應該沒有區別嗎?

任何提示?

回答

0

我相信,如果你正在使用PayPal快速,這意味着你正在做的與您的系統深度集成,你不需要IPN,你可以從

response = gateway.purchase(total_as_cents, purchase_params) 

響應,並得到所有從它的信息,而響應是IPN用於基本的貝寶的整合,從您的應用程序沒有API調用的對象

ActiveMerchant::Billing::PaypalExpressResponse 

,只有貝寶URL重定向使用參數。

+0

只有當您僅接受即時付款時纔是如此。例如,如果響應是「掛起」的,則通知完成後只能通過paypal ipn接收或定期使用paypal進行檢查。請注意,有貨幣轉換時,它可能會返回掛起狀態。 – fotanus