【发布时间】:2019-09-04 08:52:10
【问题描述】:
我正在开发市场应用程序。当从平台支付到连接帐户时,我想更新帐户的余额信息并在我的应用程序中添加收据模型。但是出现No signatures found matching the expected signature for payload 错误,我无法获得payout.paid 事件。
stripe.rb
StripeEvent.configure do |events|
# The case transfer created
events.subscribe(
'payout.paid',
Events::PayoutPaid.new
)
end
apps/services/events/payout_paid.rb
class Events::PayoutPaid
def call(event)
source = event.data.object
# Fetch balence information
account = source.destination
balance = Stripe::Balance.retrieve(
{stripe_account: account}
)
@user = User.find_by({
stripe_account_id: account
})
@user.balance = balance["available"][0]["amount"]
@user.save
# create receipt
@receipt = Receipt.new
@receipt.user = @user
@receipt.amount = source.amount
@receipt.save
end
end
虽然其他条带 webhook 也可以。
【问题讨论】:
标签: ruby-on-rails stripe-payments ngrok