Laravel收银员:恢复单笔支付

Laravel Cashier: Resume a single payment

付款成功后,我将条带 ID 存储在 mysql table 上。使用该 ID,我想检索存储在条带数据库中的所有详细信息。

那么是否可以通过条带id恢复单笔支付?

谢谢

这是您需要使用的文档:https://stripe.com/docs/api/php#retrieve_customer

使用 "customer retrieve" Stripe API 调用来检索有关客户购买的详细信息:

 Stripe::setApiKey(Config::get('your_stripe_secret_key_here'));
 $customer_object = Customer::retrieve(customers_stripe_id);

这将 return 以下 JSON:

Stripe\Customer JSON: {
  "id": "cus_7KJZQ8Z6jfSSMl",
  "object": "customer",
  "account_balance": 0,
  "created": 1447172728,
  "currency": "usd",
  "default_source": "card_175evz2eZvKYlo2CKoS2WEDk",
  "delinquent": false,
  "description": "Bingo|www|0c1234567890",
  "discount": null,
  "email": null,
  "livemode": false,
  "metadata": {
  },
  "shipping": null,
  "sources": {
    "object": "list",
    "data": [
      {
        "id": "card_175evz2eZvKYlo2CKoS2WEDk",
        "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": "Visa",
        "country": "US",
        "customer": "cus_7KJZQ8Z6jfSSMl",
        "cvc_check": "pass",
        "dynamic_last4": null,
        "exp_month": 5,
        "exp_year": 2016,
        "funding": "credit",
        "last4": "4242",
        "metadata": {
        },
        "name": null,
        "tokenization_method": null
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/customers/cus_7KJZQ8Z6jfSSMl/sources"
  },
  "subscriptions": {
    "object": "list",
    "data": [

    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_7KJZQ8Z6jfSSMl/subscriptions"
  }
}

这是 API 调用的 Stripe 版本:

\Stripe\Stripe::setApiKey("your_secret_key");
\Stripe\Customer::retrieve("the_customers_id");

确保导入 \Stripe 类,方法是在模型或控制器的顶部添加:

use Stripe\Customer;
use Stripe\Stripe;

如果您想使用 "Stripe" 而不是 \Stripe\Stripe 和 \Stripe\Customer 前缀)