#xxslasherboixx_code
1 messages ¡ Page 1 of 1 (latest)
đ 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/1263708698358972559
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hmm can you provide Ids to check? The Subscription Id and the Customer Portal Session Id
cus_QV5fnlu5ssNKnv
hello! That customer has no Subscriptions on it
are you sure you've shared the correct Customer id?
okay, and can you share the customer portal session id too? Or can you share the request id [0] where you created the portal session for this customer? it'd look like req_xxx
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
maybe you can check if it's this request? https://dashboard.stripe.com/test/logs/req_ecHcf0tne4xcRC
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yes that looks like it
the customer you passed in for that request is for cus_QV73PqP58u8uz0 which has no Subscriptions on it
how do i get a subscription created that will show in the customer portal?
maybe lets backtrack a bit, you're using a no code solution i.e. Payment Links to create Subscriptions for your customers. You're also depending on Stripe to create the Customer for you right?
well no i wasn't, i did have some code that was creating the customer. However, I tried disabling that and using this code to create the customer but then i got an error..
public function createPaymentLink(Request $request)
{
$organization = Organization::where('id', auth()->user()->org_id)->first();
Stripe::setApiKey(env('STRIPE_SECRET'));
// Create the payment link
$paymentLink = PaymentLink::create([
'line_items' => [
[
'price' => 'price_1Pe2V8B7nDl92Q4PuQiwwiPy',
'quantity' => 1,
],
],
'customer_creation' => 'always'
]);
// Redirect to the payment link URL
return redirect($paymentLink->url);
}
this is the error I received
customer_creation can only be used if the payment link does not contain any recurring prices.
I am trying to create a subscription so i would think I would want a recurring
You don't need to pass in customer_creation=always because it will always create a new Customer for a recurring price already
just omit 'customer_creation' => 'always'
hmm ok and i don't need to pass a customer id or anything?
how does that subscription get connected and therefore shown in the no code customer portal?
you don't need to pass a customer id, but if you don't, there are some implications that you need to be aware of
so you're saying to do this..
$paymentLink = PaymentLink::create([
'line_items' => [
[
'price' => 'price_1Pe2V8B7nDl92Q4PuQiwwiPy',
'quantity' => 1,
],
],
'customer' => $organization->stripe_id,
]);
if you don't pass in a Customer id, Stripe will automatically create one for you. If you want to only ensure that each Customer can have one Subscription for each email, you need to enable a setting : https://docs.stripe.com/payments/checkout/limit-subscriptions#direct-your-customers-to-the-customer-portal-or-your-website
If you don't enable this setting, and depend on Stripe to create Customers for you, you can end up with multiple Customers with the same email. Stripe does not automatically de-duplicate Customers for you
thanks, im so sorry, but im still confused as to how the customer portal and the payment link become linked? so that if a subscription is started via a payment link, how does that show up in the customer portal?
gimme a few minutes, I'm getting there
Now, going to the Customer Portal, if you enable the limit subscriptions setting, you can also use the no-code customer portal which depends on the customer's email address : https://docs.stripe.com/customer-management/activate-no-code-customer-portal
so if a Customer who has already paid for a Subscription, enters the email that they used to make payment for the Subscription for in the Customer Portal, they will be able to access the Portal and manage their existing Subscription there
does that all make sense?
ofc, ^ means you can only have one Subscription per email. If your business allows for more than one Subscription for each email/customer. This isn't going to work
To directly answer your previous question, you will only see the Subscription in the portal if your Customer actually has a Subscription that they paid for. The problem is that you were creating a Customer Portal for a Customer that hasn't paid for any Subscriptions yet
ok that last part makes sense.
upon the signup action i was creating the customer in stripe and was then storing that id on the org record level.
Would you advise not doing that and just getting the customer_id from the payment link when they are startin the subscription?
the first question i have is, will your business ever have more than one Subscription per Customer?
no only one per customer
i have enabled that limit customer to 1 subscription setting
then i would say yes, it would be easier for you to get the customer's id after the payment is completed. I'll suggest you test all of this out to make sure things work as per what you expect. Since it's mostly no-code, it should be quick to get up and running. It's possible you may have some requirement which this flow can't really accommodate
thanks, this portal looks correct
yep
i think i just need to update the customer creation flow, thank you so much
hopefully everything is smooth from here on! If you have more questions / issues, feel free to reach out again