【问题标题】:Stripe, Retrieve Card Info from EventStripe,从事件中检索卡片信息
【发布时间】:2019-03-20 12:56:56
【问题描述】:

这在一个帐户上为我工作,今天我将我的听众添加到一个新的 Stripe 帐户,现在它不再工作了。当客户向其帐户添加新的付款方式时,会触发事件customer.source.created。这是我的 WAS 代码(摘录):

<?php 
if($event->type == 'customer.source.created') {
  $cardID = $event_json->data->object->id;
  $customerID = $event_json->data->object->customer;
  $brand = $event_json->data->object->brand;
  $last4 = $event_json->data->object->last4;
  $exp_month = $event_json->data->object->exp_month;
  $exp_year = $event_json->data->object->exp_year;
}
?>

这是一个示例 Stripe JSON 响应:

    {
  "id": "evt_1DLkAh2Y54K5YG39Lku1hJ1G",
  "object": "event",
  "api_version": "2018-09-24",
  "created": 1539664123,
  "data": {
    "object": {
      "id": "card_1DLkAf2Y54K5YG39C0jMpCOj",
      "object": "card",
      "address_city": null,
      "address_country": null,
      "address_line1": null,
      "address_line1_check": null,
      "address_line2": null,
      "address_state": null,
      "address_zip": null,
      "address_zip_check": null,
      "brand": "JCB",
      "country": "JP",
      "customer": "cus_DnCcf39Nqp4RwF",
      "cvc_check": "pass",
      "dynamic_last4": null,
      "exp_month": 12,
      "exp_year": 2024,
      "fingerprint": "t56gZmsPg6ztkHFH",
      "funding": "credit",
      "last4": "0000",
      "metadata": {
      },
      "name": null,
      "tokenization_method": null
    }
  },
  "livemode": false,
  "pending_webhooks": 2,
  "request": {
    "id": "req_L9pvt2RR3VSZoG",
    "idempotency_key": null
  },
  "type": "customer.source.created"
}

Stripe 响应代码是 200。我的侦听器中有其他事件,例如 charge.succeeded,它们使用几乎相同的编码方法工作得很好。现在,我无法让 $cardID 回显。所以我想知道 Stripe 最近是否改变了一些东西。我在 Webhooks 中运行最新版本。我确实尝试恢复到旧版本,但也没有用。

【问题讨论】:

    标签: php json stripe-payments


    【解决方案1】:

    好的,这是一个我没有发现的非常愚蠢的问题。我今天设置的条带帐户是旧版本,并且有可用更新。我没听懂,因为我在测试模式下工作,你只能在实时模式下升级。

    因此,升级后,一切正常。浪费了数小时的时间和如此简单的事情。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-21
      • 2020-03-28
      • 1970-01-01
      • 2019-10-29
      • 2019-09-15
      • 2018-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多