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