Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sirhxalot's avatar

Stripe InvoiceFor Billing Details

Hi Folks!

I am using Larvel Cashier in order to make a single charge for a credit card. But instead of using the ~~charge~~ method I am using the invoiceFor method of cashier:

 $user->invoiceFor(__('events.1.title'), $user->participation->plan_price, [], []);

Now I want to update the billing details from the payment method. Does somebody know how to achieve this?

When I dd the payment method I receive something like:

Laravel\Cashier\PaymentMethod {#392 ▼
  #owner: App\Models\User {#351 ▶}
  #paymentMethod: Stripe\PaymentMethod {#374 ▼
    +saveWithParent: false
    #_opts: Stripe\Util\RequestOptions {#363 ▶}
    #_originalValues: array:9 [▶]
    #_values: array:9 [▶]
    #_unsavedValues: Stripe\Util\Set {#376 ▶}
    #_transientValues: Stripe\Util\Set {#377 ▶}
    #_retrieveOptions: []
    #_lastResponse: null
    id: "NoNo"
    object: "payment_method"
    billing_details: Stripe\StripeObject {#378 ▼
      #_opts: Stripe\Util\RequestOptions {#363 ▶}
      #_originalValues: array:4 [▶]
      #_values: array:4 [▶]
      #_unsavedValues: Stripe\Util\Set {#380 ▶}
      #_transientValues: Stripe\Util\Set {#381 ▶}
      #_retrieveOptions: []
      #_lastResponse: null
      address: Stripe\StripeObject {#382 ▼
        #_opts: Stripe\Util\RequestOptions {#363 ▶}
        #_originalValues: array:6 [▶]
        #_values: array:6 [▶]
        #_unsavedValues: Stripe\Util\Set {#384 ▶}
        #_transientValues: Stripe\Util\Set {#385 ▶}
        #_retrieveOptions: []
        #_lastResponse: null
        city: null
        country: null
        line1: null
        line2: null
        postal_code: "44444"
        state: null
      }
      email: null
      name: "MICKEY MOUSE"
      phone: null
    }
    card: Stripe\StripeObject {#379 ▶}
    created: 1582205683
    customer: "NoNo"
    livemode: false
    metadata: Stripe\StripeObject {#383 ▶}
    type: "card"
  }
}

This is why I thought I can update the data like the following:

$paymentMethod = auth()->user()->paymentMethods()->first();
$paymentMethod->billing_details->email = auth()->user()->email;
$paymentMethod->save();

Unfortunally that does not work - so how to update the data?

Thank you in advance and best regards Alexander

0 likes
5 replies
sirhxalot's avatar

@bobbybouwmann Thank you (again ;)

Do you know how I can found out what array keys are expected for $options? Is there a list or can I jump to any source code to get a list?

Thank you in advance.

sirhxalot's avatar

@bobbybouwmann sorry for the wording but you are fucking awesome!

For real I appriciate your help so much - you are superman, or Jeffrey Way - Keep on going!

Here is a quick hint:

        $user->createOrGetStripeCustomer([
            'address' => [
                'line1' => 'Evergreen Terrace 5'
            ]
        ]);

Which result in:

Please or to participate in this conversation.