Stripe Webhook用于“ customer.source.expiring”

时间:2019-03-15 01:49:25

标签: stripe-payments webhooks

我试图在customer.source.expiring事件中找到某种类型的客户识别数据,而不是src_xxxxxxxxxx id来使用。我很难相信源令牌(一次使用令牌在此之后基本上变得不可见)是我用于此事件的标识符。是这种情况,还是我缺少明显的东西?

这是示例Webhook测试事件。

{
  "created": 1326853478,
  "livemode": false,
  "id": "customer.source.updated_00000000000000",
  "type": "customer.source.updated",
  "object": "event",
  "request": null,
  "pending_webhooks": 1,
  "api_version": "2018-11-08",
  "data": {
    "object": {
      "id": "src_00000000000000",
      "object": "source",
      "ach_credit_transfer": {
        "account_number": "test_52796e3294dc",
        "routing_number": "110000000",
        "fingerprint": "ecpwEzmBOSMOqQTL",
        "bank_name": "TEST BANK",
        "swift_code": "TSTEZ122"
      },
      "amount": null,
      "client_secret": "src_client_secret_EhU5oTFQIitVsCD6rC93j6eM",
      "created": 1552614338,
      "currency": "cad",
      "flow": "receiver",
      "livemode": false,
      "metadata": {
      },
      "owner": {
        "address": null,
        "email": "jenny.rosen@example.com",
        "name": null,
        "phone": null,
        "verified_address": null,
        "verified_email": null,
        "verified_name": null,
        "verified_phone": null
      },
      "receiver": {
        "address": "121042882-38381234567890123",
        "amount_charged": 0,
        "amount_received": 0,
        "amount_returned": 0,
        "refund_attributes_method": "email",
        "refund_attributes_status": "missing"
      },
      "statement_descriptor": null,
      "status": "pending",
      "type": "ach_credit_transfer",
      "usage": "reusable"
    },
    "previous_attributes": {
      "exp_year": "2013"
    }
  }
}

我可以使用该电子邮件地址,因为我可以强制重用客户,而无需放弃Stripe上的客户帐户并建立一个新帐户。但是,由于Stripe也不执行该AFAIK,仅抓取电子邮件并在Stripe中查找电子邮件似乎是一个非常糟糕的解决方案。

我应该只是将创建时的源令牌存储在数据库中,然后每天调用它,还是可以通过其他方法来实现呢?

谢谢。

0 个答案:

没有答案