dongtuanzi1080 2017-03-31 08:12
浏览 59

使用Laravel Cashier向Stripe发送其他参数

The Laravel docs states how to send extra parameters to Stripe like email. My question is how to send other parameters like adress and name. Below is some of the customer.updated webhook.

"sources": {
  "object": "list",
  "data": [
    {
      "id": "card_1A3KXJUybOxa5viznC3iZy5U",
      "object": "card",
      "address_city": null, 
      "address_country": null,
      "address_line1": null,
      "address_line1_check": null,
      "address_line2": null,
      "address_state": null,
      "address_zip": null,

And in my Laravel controller..

 $user->newSubscription('Silver', 'Silver')->create($creditCardToken, [
       'email' => $request->input('email'),
       'description' => 'Silver membership'
 ]);

The above works fine to send email and description to Stripe. But 'adress_city' => 'New York' for example doesn't.

  • 写回答

2条回答 默认 最新

  • dshmkgq558192365 2018-02-23 09:29
    关注

    You can send other data using metadata key like this below.

    $user->newSubscription('Silver', 'Silver')->create($creditCardToken, [
       'email' => $request->input('email'),
       'description' => 'Silver membership',
       'metadata' => [
                    'adress_city' => 'New York',
                ],
    
    ]);
    

    Thanks,

    评论

报告相同问题?