#sergx_subscription-existing-pm

1 messages ¡ Page 1 of 1 (latest)

opal cosmosBOT
fickle urchinBOT
#

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.

opal cosmosBOT
#

👋 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.

proper dirge
#

hi there!

grizzled furnace
#
$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'),
            ]);
        }

proper dirge
#

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?

grizzled furnace
#

yes exactly. In this case, the user has already a default payment method

proper dirge
grizzled furnace
#

and in this case shopuld I modify something about payment_behavior?

#

or should I let it as default_incomplete?

proper dirge
#

I recommend using allow_incomplete

grizzled furnace
#

perfect i'm going to test it, thank you so much

opal cosmosBOT
#

sergx_subscription-existing-pm

grizzled furnace
#

is it possible to attach a payment method of a customer to another customer?

magic elbow
#

No

grizzled furnace
#

and if I use stripe elements, can I set and use the same card in different customers?

magic elbow
#

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.

grizzled furnace
#

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?

magic elbow
#

Yes, metadata is the perfect spot to store data that is important to your flows that we don't already collect.

grizzled furnace
#

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

magic elbow
#

Yes, unless you update the metadata it won't change.

grizzled furnace
#

perfect thank you so much toby

magic elbow
#

You got it!

#

Let me know if what I've been describing doesn't line up with what you're seeing in your testing.