#xfechx_api
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/1288816987593637951
π Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- xfechx_connect-paymentmethods, 2 days ago, 90 messages
And if you Γ¦re looking for a particular flow (.e.g Subscription Update), I invite you to follow this guide then:
https://docs.stripe.com/customer-management/portal-deep-links
I don't want the customer portal
I need to create a URL where the subscriber can update their payment method.
as simple as when you go into the dashboard and generate an update payment method link for that subscription.
there should be an API function that allows for this
No that's a Dashboard feature only. The equivalent using the public APIs is the Customer Portal.
The flow is payment_method_update
https://docs.stripe.com/customer-management/portal-deep-links#:~:text=EXAMPLE-,payment_method_update,-Use payment_
yes sure.
how can I translate the following php code, to also account for connected accounts:
// See your keys here: https://dashboard.stripe.com/apikeys
$stripe = new \Stripe\StripeClient('sk_test_Y17KokhC3SRYCQTLYiU5ZCD2');
$stripe->billingPortal->configurations->create([
'business_profile' => [
'headline' => 'Cactus Practice partners with Stripe for simplified billing.',
],
'features' => ['invoice_history' => ['enabled' => true]],
]);```
Are you looking for this?
https://docs.stripe.com/connect/authentication?lang=php#stripe-account-header
yes, but please help me with the example above.
also, I am getting the following error. I have implemented the customer portal before, and it was working. Lately it has this error:
Stripe API Error: The PortalConfiguration's subscription pause has been deprecated and is no longer available. Learn more at https://support.stripe.com/questions/billing-customer-portal#pausing
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
hi! I'm taking over this thread. can you share the request ID?
Sure
where can I find the id of the request, for a connnected account which launched the customer portal ?
I am in the platform > developers > logs (test mode)
the portal was created on the platform account or the connected account with the Stripe-Account header?
conected account
then you can check your platform logs, but filter only ougoing connect requests
req_RQvMvaJwq2Se2T
this API request was successful. can you share the API request that failed with the error message you shared previously?
yes, already delted the line for subscription update, which afaik is not longer supported
I want to be able to modify payment methods using that billing portal.
then you need to create a new portal configuration and enable payment_method_update: https://docs.stripe.com/api/customer_portal/configurations/create?lang=node#create_portal_configuration-features-payment_method_update
OK, so my original question is if I can do this type of deep links in a simpler way?
I would like to email customers when their subscriptions fail and have a link that they can simply update their payment method
have you read this about deep links? https://docs.stripe.com/customer-management/portal-deep-links
i am reading about it
why is subscription update still there, but when using it doesn't work?
what doens't work?
π stepping in
Yeah looks like you are attempting to set subscription_pause but that parameter has been deprecated for a while now
So you have to remove that from your portal configuration
ok, so just to recap. I need to make a deep link with billing portal through the api, when the event invoice.payment failed
to have teh customer update their payment details for that specific subscription
Yes if you want a hosted update page
Hmm not sure that will update for a specific Subscription though
Versus setting the default on the Customer
Yeah believe that would just set the default on the Customer, see: https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-flow_data-type
OK thanks.
How can I make a test payment with no funds so that I can trigger a invoice.payment_failed instantaneously?
You likely want to use the "decline after attaching" card: https://docs.stripe.com/testing#declined-payments
So start a Sub, update your customer to use that card, advance time to the next Invoice
Alternatively you should be able to use the CLI for this and just trigger the Event
@restive patrol please start your own thread if you have a question using the #help channel
Ok, how can I find the subscription of the connected account under test mode, to change clock?
If you look at the Connected Account in your Dashboard then in the top right there are 3 dots and you should be able to "View Dashboard As"
I think you can then advance time, but you might not have the permissions to do that from the platform in the Dashboard -- not sure on that since we focus on the API here.
Possible you need to use the API
Alternatively you can just update the Subscription to trigger a new Invoice
You don't necessarily have to advance time to trigger a payment attempt
I have the Subscription here with time advanced
but the event did not trigger
I can only see an invoice as draft
You likely need to advance time a bit further
Invoices finalize an hour after the Subscription renews, however this can be a little finicky with test clocks so I'd advance a day past to be safe
ok, advancing an entire day would already trigger all events?
It already has a failed payment attached method
Hmm not sure what you mean at this point?
You should have attached the PaymentMethod before you advanced time
Then you advance to trigger the decline
OK, it is already triggered the event that I need my webhook to listen to
invoice.payment_failed
however - I cannot retrigger the event
It failed (500 error) , I now fixed the error, but need to retrigger again
and in the event screen I cannot retrigger like usual (by clicking the three dots on the right hand side of the webhook attempt of that event)
i can see the webhook attempts and the webhook attempts to connected accounts
If you use the CLI this is much easier to test -- you should be able to just call stripe trigger invoice.payment_failed --stripe-account acct_123
I would like to do it how I usually do it..
I need to then login to connected account and under the events, correct?
If I do it with CLI I will trigger that event for which subscription, etc?
Also - I had it set up so when subscription payment fails, the customer receives the notification with the invoice link, and when they pay it, the card gets updated.
What is better? To use billing portal, or to use the invoice directly?
So for example, right now - my customers receive an email with a link to the invoice in question, invoice have the ability to be paid on the spot
with the invoice link
so they get the invoice link, they can pay it manually and this will update their payment method for that subscription
also, I am trying to resend a test webhook for a connected account, but I cannot
it doesn't allow me
You tried with that command my colleague sent?
no, because I am not used to see them like this.
I usually see the webhook list and I can debug there
but for a connected (express) test account, this is not working, or I need to find out where I can see this and resend the webhooks
I am doing the following:
Platform Dashboard > Connected Accounts > Connected Account > Payments > Click on payment intent > scroll down to all activity > invoice.payment_failed > view event detail > then I can see the list of webhooks
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yeah idk we're not that familiar with dashboard flows in here
That's why we recommended a cli solution
ok, so with CLI
how to do it?
How will I be able to make a real-life like event?
with a real subscription (test mode)
it is annoying that I cannot use the resend command
Please send me step by step instruction
I can also in this screen, see the webhook CLI responses, there is none yet.
But how do I send a CLI webhook to this page
Why can't you? You should be able to
I have no idea what screen you're talking about
The Stripe Shell does not currently support flags for this command.```
then follow the link please
I sent you the path I follow to reach there
here
That's not the resend command
Also what version of the cli are you using?
That command does support flags
Likely you're on an old version
please lets focus not on cli
I need to resend a webhook
usually I can do it with the dashboard, I have done that for YEARS.
Ok as I said we're not familiar with dashboard flows in here
\In this scenario this is for a connected account express
so I have been here in this discord chat for YEARS also
this is the first time that I hear you are not familiar
I don't want to talk to stripe support obviously
they don't know anything usually
I ALWAYS come here
Yeah I mean my team isn't that familiar with the dashboard, so idk how to do what you want to do
I am trying to help you via the cli
ok
sure, please help me how to do it so that I can resend the invoice.payment failed for the subscription in question
Ok so based on your above details you may have an older version
Can you run https://docs.stripe.com/cli/version
Recommend upgrading to the latest first
No I mean run stripe version in the cli
I need to have it installed, bla bla bla
usually I do it this way, and it was easy for me
with this approach, because I can also 'echo' debugging, and I can see it in this screen I shared
Not sure I understand. Above is a dashboard screenshot
How can I give you an error
I am getting No such customer: 'cus_Qv9x2XTYwI7WMk'
this is the event evt_1Q3JjHQYZ1t4Gj5KsnRfLCHC
OK, sorry - I am able to debug now. Doing it differently, but yes - if you could help me get going with CLI then that'be great.
Hello! I'm taking over and catching up...
Okay, so your goal is to resend evt_1Q3JjHQYZ1t4Gj5KsnRfLCHC using Stripe CLI?
If so, the reference for the resend command is here: https://docs.stripe.com/cli/events/resend
Should be something like stripe events resend --account=acct_123 evt_123 since this is an Event on a connected account.
ok, will try this, thanks
how can I obtain the billing portal link once I created the object?
is it $stripe_bp_session->link ??
No, a Customer Portal Session has a url property: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-url
thank you, yes got it
so I solved the error, but maybe i should use this opportunity to start using cli
so that I don't bother again with this issues..
these*
The CLI is pretty handy when building an integration. π
I cannot use it via online cli , I just don't know how to start
do I need to install it in the server?
Typically people install the CLI locally, on their own machine.
The Stripe CLI is designed mostly as a development tool to use in test mode, so it usually doesn't make much sense to install it on a server unless you have unusual requirements.
I am stuck with the billing portal not allowing a subscription id
which is on the invoice->subscriptioin
What do you mean by "not allowing"?
No such subscription: 'sub_1Q3KaCQYZ1t4Gj5KhAiECfdv'
I am getting that error
evt_1Q3Kj5QYZ1t4Gj5KJz3J5m7I
Can you give me the request ID showing that error?
that is the event
I don't have the request ID unfortunately. I am still not getting to using the CLI
I am in the webhook screen in the dashboard
all my requests send the connected account header
Hm, so it looks like this Subscription exists on a connected Express account. That means you're trying to use direct charges on an Express account, which we don't recommend. Why didn't you create this Subscription on your platform with the Express account specified as the destination?
Yes, I know, but why? Why are you doing direct charges instead of destination charges?
Not sure, this already works and that is the method I used many years ago, right now I am fixing a little thing on a big system
I cannot make design changes right now
so I am stuck in the last bit creating a session portal link
I can make already the session link, but if I do not define the flow_data
when passing flow_data[type][subscription], the subscription taken from invoice->subscription is not working, for some reason
even though the billing portal is created with connected_account header.
so not sure why it is not recognizing the subscription (from the invoice event)
Oh, this Subscription is using a Test Clock. I don't think you can use Subscriptions in a Test Clock with the Customer Portal...
Yeah, I'm investigating now.
billing portal link
Ah, I found the issue. The Subscription has been canceled.
Have a look at evt_1Q3Kj8QYZ1t4Gj5KNRNCrAy5 on the connected account.
ok, meanwhile - I made a new one, added a failing card, and advanced it, to show you:
I will now add the flow data
to see if it works. I need to advance it again for another interval
There was a problem with your transaction<br>This subscription cannot be updated because the subscription update feature in the portal configuration is disabled.
that is the error I get
Sounds like you need to adjust the Portal Configuration to allow for updates.
I have this code:
'business_profile' => [
'headline' => 'Here you can modify the Subscription',
],
'features' => [
'invoice_history' => ['enabled' => true],
//'subscription_cancel' => ['enabled' => true],
'payment_method_update' => ['enabled' => true],
'customer_update' => [
'allowed_updates' => ['name', 'address', 'email', 'phone', 'shipping', 'tax_id'],
'enabled' => true,
],
],
], $connected_account);
$stripe_bp_session = $stripe->billingPortal->sessions->create([
'customer' => $invoice->customer,
//'return_url' => $return_url,
//'on_behalf_of' => $connect,
'configuration' => $stripe_bpc,
'flow_data' => [
'type'=> 'subscription_update',
//'subscription_cancel' => ['subscription' => $subscription_id],
'subscription_update' => ['subscription' => $subscription],
//'customer_update' => ['customer' => $stripe_customer_id],
]
], $connected_account);```
sorry, I am trying to update payment method for a certain subsription
I am not entirely sure how to do it
for the failed payment subscription
Can you give me the request ID showing that error?
sure
It really helps us a lot if you can provide request IDs in situations like this.
You don't need to use Stripe CLI.
There are still API requests happening, and they should show up in your logs.
which logs
You can also get request IDs in code: https://docs.stripe.com/api/request_ids
sorry if I sound ignorant
Your Dashboard logs.
You can view request logs for your connected accounts by viewing the Dashboard as the connected account.
Yeah, so in this request you're passing in a Subscription, but you have Subscription updates disabled, hence the error.
If you're only trying to allow the Customer to update their payment info you need to remove the Subscription from the request.
ok, advancing
Missing required param: features[subscription_update][default_allowed_updates].
Hi π
I'm stepping in as my colleague has to go. Can you provide the request ID for the request that throws this error? It will start with req_
req_VU3EJMIpjOt8YZ
Okay yes it lookes like you are missing the required parameter of what specific updates are allowed for subscriptions
If you check the following link:
it doesn't have any flow data
can customers update the payment details for that specific subscription there, like that?
How did you create that portal session? What parameters did you specify?
here
I am trying to allow the customer to update their payment method for that subscription
that is all i need
I took a look at the portal link, I can update payment methods on it.
It looks like that does what you want
so this is triggered by a invoice.payment_failed
so updating the payment method OR paying the invoice would update the payment method for next invoices too?
Have you tested that yourself?
No
For most things Billing related (Invoices, Subscriptions, etc.) my first piece of advice is to test out the entire flow yourself to make sure it behaves how you expect
Thanks a lot for your help all