#sergx_subscription-existing-pm
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sergx_best-practices, 47 minutes ago, 4 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1242456036103946250
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
$subscription = $this->stripe->subscriptions->create([
'customer' => $newUser->stripe_id,
'items' => [
['price' => $planPriceId, 'quantity' => 1],
['price' => $employeesPriceId, 'quantity' => $request->employees],
],
'proration_behavior' => 'always_invoice',
'payment_behavior' => 'default_incomplete',
'coupon' => config('app.agency_discount'),
'automatic_tax' => ['enabled' => true],
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
]);
if ($subscription->pending_setup_intent !== NULL) {
return response()->json([
'type' => 'setup',
'clientSecretStripe' => $subscription->pending_setup_intent->client_secret,
'succesUrl' => route('activation'),
]);
} else {
return response()->json([
'type' => 'payment',
'clientSecretStripe' => $subscription->latest_invoice->payment_intent->client_secret,
'succesUrl' => route('activation'),
]);
}
Is it possible when creating a new subscription to pass a payment method in the server.
you mean you already have a PaymentMethod stored in Stripe that you want to use for this Subscrition?
yes exactly. In this case, the user has already a default payment method
then you can set default_payment_method when creating the Susbcription: https://docs.stripe.com/api/subscriptions/create#create_subscription-default_payment_method
and in this case shopuld I modify something about payment_behavior?
or should I let it as default_incomplete?
I recommend using allow_incomplete
perfect i'm going to test it, thank you so much
is it possible to attach a payment method of a customer to another customer?
No
and if I use stripe elements, can I set and use the same card in different customers?
Yup. You cannot attach a single Payment Method to more than one Customer, but you can have multiple Payment Methods attached to multiple Customers that represent the same actual card.
perfect thanks
one dobut please, when creating the subscription I want to link it with a parent user Id and a child user Id
I can use metadata for that right?
Yes, metadata is the perfect spot to store data that is important to your flows that we don't already collect.
metada is inmutable? I mean, if the subscription is updated or when the next invoice is charged, it will be there right?
unless metada is updated too I guess
Yes, unless you update the metadata it won't change.
perfect thank you so much toby