2013-10-17 79 views
1

所以我在我的應用程序中做了一個條形支付選項。當我點擊按鈕付款時,它會告訴我付款是成功的。當我去我的條紋帳戶並進行條紋測試並檢查日誌時,我可以看到我的測試支付代碼爲200 OK。但是這種付款不會顯示在條紋測試事件或條紋測試付款中。是第二天處理日誌付款還是我做錯了?條紋付款問題軌道上的紅寶石

def charge 
    Stripe.api_key = "some_test_api_key" 
    customer = Stripe::Customer.retrieve(stripe_customer_id) 

    if stripe_customer_id.nil? 
    Stripe::Charge.create(
     :amount => 2500, 
     :currency => "cad", 
     :customer => stripe_customer_id, 
     :description => "Usage charges for #{name}" 
    ) 
    end 
    rescue Stripe::StripeError => e 
    logger.error "Stripe Error: " + e.message 
    errors.add :base, "Unable to process charge. #{e.message}." 
    false 
    end 
+0

給予更多的上下文和代碼可以在這裏幫助。 – nicooga

+0

def charge Stripe.api_key =「some_test_api_key」 customer = Stripe :: Customer.retrieve(stripe_customer_id) if stripe_customer_id.nil? 條紋:: Charge.create ( :量=> 2500, :貨幣=> 「CAD」, :客戶=> stripe_customer_id, \t \t描述=> 「爲#{名稱}用法費用」) end rescue Stripe :: StripeError => e logger.error「Stripe Error:」+ e.message errors.add:base,「Unable to process charge。#{e.message}。」 false 結束 這是我的方法 –

+0

我得到我應該在日誌中的一切 –

回答

0

只有在stripe_customer_idnil時纔會執行此操作。你想要的是相反的,!stripe_customer_id.nil

0

我沒有分離開的意見,所以我必須張貼它像一個答案.. 付款應即時處理,所以必須在你的請求時出現問題。

Webhooks對付款沒有任何影響,僅用於跟蹤您網站上的活動。

請問,你能顯示你的請求的身體和條紋的反應?你可以在日誌中檢查它。

+0

我正在研究一點,是否有可能是條紋不捕獲電荷?你在問題中有我的方法,所以如果你可以檢查.. 這是我的解析的請求查詢參數:卡: 名稱: 「未定義」 號: 「**** **** **** 4242」 CVC: 「***」 exp_month: 「1」 exp_year: 「2017年」 鍵: 「測試API密鑰」 回調: 「sjsonp1382114814769」 _method: 「POST」 –

+0

,這是我的迴應主體: ID:tok_2mEtVDbZv6V0ak livemode:假 創建:1382114851 使用:假 object:「token」 type:「card」 card: id:card_2mEtm950YzGMTo object:「card」 LAST4: 「4242」 類型: 「簽證」 exp_month:1 exp_year:2017年 指紋: 「IA76WK3FlCblrBeL」 客戶:空 國家: 「美國」 名稱: 「未定義」 ADDRESS_LINE1:空 ADDRESS_LINE2:空 address_city:null address_state:null address_zip:null address_country:null –

+0

我什麼都沒有:Parsed Request POST Body –