在我的rails 4应用程序中,我正在使用Braintree沙箱测试事务网关。我能够执行交易,交易详细信息在我的沙箱帐户中可见。但我的问题是如何将交易详细信息存储到我的数据库中的表中?
例如:交易ID,金额,客户详细信息等?
我的代码如下:
def payment_process
@paymentamnt=@@deviceprice.to_i
@result = Braintree::Transaction.sale(
amount: @paymentamnt,
payment_method_nonce: params[:payment_method_nonce])
if @result.success?
redirect_to payments_customers_path
else
flash[:alert] = "Something went wrong while processing your transaction. Please try again!"
gon.client_token = generate_client_token
render :new
end
end
答案 0 :(得分:3)
您要查找的值存储在transaction
的{{1}}对象中。
所以你可以像这样访问它们:
@result
等