【问题标题】:What stripe payment charge information should be stored by the application?应用程序应存储哪些条带支付费用信息?
【发布时间】:2020-12-13 01:14:22
【问题描述】:

在集成条带支付(或条带连接)时,条带在尝试支付后返回一个Stripe::Charge 对象给应用程序。

存储此信息的最佳做法是什么,即应用程序应在其数据库中存储哪些字段?

我认为应用程序至少应该存储:

  • 付款的id(这样以后可以查到),
  • 付款的status(以便应用知道付款是否通过)
  • 应用程序显然应该记录付款对应的购买

Stripe::Charge 对象中还有许多其他字段似乎非常重要。但是,存储所有内容可能完全没有必要(矫枉过正)。

下面是一个在创建付款意图后返回的Stripe::Charge 对象示例:

{
  "id": "ch_1HwISYGtUKse83O9n9LJ5DK1",
  "object": "charge",
  "amount": 30000,
  "amount_captured": 30000,
  "amount_refunded": 0,
  "application": null,
  "application_fee": "fee_1HwISY2fgYVxT5fZTsciNPKg",
  "application_fee_amount": 4500,
  "balance_transaction": "txn_1HwISZGtUKse83O9kkrHTynB",
  "billing_details": {"address":{"city":null,"country":null,"line1":null,"line2":null,"postal_code":"41234","state":null},"email":null,"name":"Ben Johnson","phone":null},
  "calculated_statement_descriptor": "JOE SMITH",
  "captured": true,
  "created": 1607481078,
  "currency": "usd",
  "customer": null,
  "description": null,
  "destination": "acct_1HtSLp2fgYVxT5fZ",
  "dispute": null,
  "disputed": false,
  "failure_code": null,
  "failure_message": null,
  "fraud_details": {},
  "invoice": null,
  "livemode": false,
  "metadata": {},
  "on_behalf_of": "acct_1HtSLp2fgYVxT5fZ",
  "order": null,
  "outcome": {"network_status":"approved_by_network","reason":null,"risk_level":"normal","risk_score":63,"seller_message":"Payment complete.","type":"authorized"},
  "paid": true,
  "payment_intent": "pi_1HwIQwGtUKse83O9R4k7NiUa",
  "payment_method": "pm_1HwISXGtUKse83O9ua95HqYJ",
  "payment_method_details": {"card":{"brand":"visa","checks":{"address_line1_check":null,"address_postal_code_check":"pass","cvc_check":"pass"},"country":"US","exp_month":12,"exp_year":2034,"fingerprint":"W0rYzPMfZtx74C5u","funding":"credit","installments":null,"last4":"4242","network":"visa","three_d_secure":null,"wallet":null},"type":"card"},
  "receipt_email": null,
  "receipt_number": null,
  "receipt_url": "https://pay.stripe.com/receipts/acct_1HYHSFGtUKse83O9/ch_1HwISYGtUKse83O9n9LJ5DK1/rcpt_IXNCchkcmv9fndlQPRCjh4mEtdNtTn0",
  "refunded": false,
  "refunds": {"object":"list","data":[],"has_more":false,"total_count":0,"url":"/v1/charges/ch_1HwISYGtUKse83O9n9LJ5DK1/refunds"},
  "review": null,
  "shipping": null,
  "source": null,
  "source_transfer": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "succeeded",
  "transfer": "tr_1HwISYGtUKse83O9q9ZEE4Gq",
  "transfer_data": {"amount":null,"destination":"acct_1HtSLp2fgYVxT5fZ"},
  "transfer_group": "group_pi_1HwIQwGtUKse83O9R4k7NiUa"
}

那么简单实用的问题:在上述信息中,哪些字段应该存储在应用程序的数据库中?

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    这完全取决于您的应用程序的需求,并且没有通用的答案。您可以存储全部、不存储或选择字段。

    id 是一个很好的起点,当然。如果您使用的是客户,您可能还想存储关联的客户 ID。如果您使用目的地费用,您可能希望存储相关帐户。如果您想做一些自定义会计,您可以存储金额和费用。

    这取决于。存储任何你喜欢的东西。

    【讨论】:

      猜你喜欢
      • 2012-06-10
      • 2016-12-11
      • 1970-01-01
      • 2012-08-26
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      • 2013-08-20
      • 1970-01-01
      相关资源
      最近更新 更多