#xfechx_api

1 messages Β· Page 1 of 1 (latest)

loud ledgeBOT
#

πŸ‘‹ 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.

vernal pine
#

You mean you want to generate it using Stripe API ?

#

or what exactly ?

magic fog
#

hello

#

Yes

#

I would like to generate that link through the stripe API

vernal pine
magic fog
#

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

vernal pine
#

No that's a Dashboard feature only. The equivalent using the public APIs is the Customer Portal.

magic fog
#

OK

#

can you please help me with teh following

vernal pine
magic fog
#

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]],
]);```
vernal pine
magic fog
#

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

vernal pine
loud ledgeBOT
oblique adder
#

hi! I'm taking over this thread. can you share the request ID?

magic fog
#

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)

oblique adder
#

the portal was created on the platform account or the connected account with the Stripe-Account header?

magic fog
#

conected account

oblique adder
#

then you can check your platform logs, but filter only ougoing connect requests

magic fog
#

req_RQvMvaJwq2Se2T

oblique adder
#

this API request was successful. can you share the API request that failed with the error message you shared previously?

magic fog
#

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.

oblique adder
magic fog
#

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

oblique adder
magic fog
#

i am reading about it

#

why is subscription update still there, but when using it doesn't work?

oblique adder
#

what doens't work?

loud ledgeBOT
magic fog
#

did you see the error?

#

req_rOBn4CaFLC9OAE

chrome knot
#

πŸ‘‹ 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

magic fog
#

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

chrome knot
#

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

magic fog
#

OK thanks.
How can I make a test payment with no funds so that I can trigger a invoice.payment_failed instantaneously?

chrome knot
#

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

magic fog
#

How do I advance time to the next Invoice

#

I have never done that before

chrome knot
magic fog
#

Ok, how can I find the subscription of the connected account under test mode, to change clock?

chrome knot
#

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

magic fog
#

I have the Subscription here with time advanced

#

but the event did not trigger

#

I can only see an invoice as draft

chrome knot
#

You likely need to advance time a bit further

magic fog
#

how long tho

#

to what time of the day that it was created?

chrome knot
#

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

magic fog
#

ok, advancing an entire day would already trigger all events?

#

It already has a failed payment attached method

chrome knot
#

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

loud ledgeBOT
magic fog
#

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

chrome knot
#

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

magic fog
#

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?

stark ingot
#

Hi taking over here

#

What do you mean by this?

magic fog
#

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

stark ingot
magic fog
#

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

stark ingot
#

Yeah idk we're not that familiar with dashboard flows in here

#

That's why we recommended a cli solution

magic fog
#

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

stark ingot
stark ingot
magic fog
#
The Stripe Shell does not currently support flags for this command.```
magic fog
#

I sent you the path I follow to reach there

stark ingot
#

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

magic fog
#

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.

stark ingot
magic fog
#

\In this scenario this is for a connected account express

stark ingot
#

I can help you with cli

#

If you want dashboard support, talk to our support team

magic fog
#

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

stark ingot
#

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

magic fog
#

ok

#

sure, please help me how to do it so that I can resend the invoice.payment failed for the subscription in question

stark ingot
#

Ok so based on your above details you may have an older version

#

Recommend upgrading to the latest first

magic fog
stark ingot
#

No I mean run stripe version in the cli

magic fog
#

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

stark ingot
#

Not sure I understand. Above is a dashboard screenshot

magic fog
#

How can I give you an error

#

I am getting No such customer: 'cus_Qv9x2XTYwI7WMk'

#

this is the event evt_1Q3JjHQYZ1t4Gj5KsnRfLCHC

loud ledgeBOT
magic fog
#

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.

naive bridge
#

Hello! I'm taking over and catching up...

#

Okay, so your goal is to resend evt_1Q3JjHQYZ1t4Gj5KsnRfLCHC using Stripe CLI?

#

Should be something like stripe events resend --account=acct_123 evt_123 since this is an Event on a connected account.

magic fog
#

ok, will try this, thanks

#

how can I obtain the billing portal link once I created the object?

#

is it $stripe_bp_session->link ??

naive bridge
magic fog
#

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*

naive bridge
#

The CLI is pretty handy when building an integration. πŸ™‚

magic fog
#

I cannot use it via online cli , I just don't know how to start

#

do I need to install it in the server?

naive bridge
#

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.

magic fog
#

I am stuck with the billing portal not allowing a subscription id

#

which is on the invoice->subscriptioin

naive bridge
#

What do you mean by "not allowing"?

magic fog
#

No such subscription: 'sub_1Q3KaCQYZ1t4Gj5KhAiECfdv'

#

I am getting that error

#

evt_1Q3Kj5QYZ1t4Gj5KJz3J5m7I

naive bridge
#

Can you give me the request ID showing that error?

magic fog
#

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

naive bridge
#

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?

magic fog
#

so not sure what is happening

#

Yes, the subscription is on the connected account

naive bridge
#

Yes, I know, but why? Why are you doing direct charges instead of destination charges?

magic fog
#

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)

naive bridge
#

Oh, this Subscription is using a Test Clock. I don't think you can use Subscriptions in a Test Clock with the Customer Portal...

magic fog
#

But I already did

#

one moment

#

I will show you

naive bridge
#

Yeah, I'm investigating now.

magic fog
#

billing portal link

naive bridge
#

Ah, I found the issue. The Subscription has been canceled.

#

Have a look at evt_1Q3Kj8QYZ1t4Gj5KNRNCrAy5 on the connected account.

magic fog
#

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

naive bridge
#

Sounds like you need to adjust the Portal Configuration to allow for updates.

magic fog
#

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);```
naive bridge
#

Yeah, yo're not allowing for Subscription updates in that Portal Configuration.

magic fog
#

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

naive bridge
#

Can you give me the request ID showing that error?

magic fog
#

sure

naive bridge
#

It really helps us a lot if you can provide request IDs in situations like this.

magic fog
#

I know, but would need to use stripe CLI

#

and I don't know that yet

naive bridge
#

You don't need to use Stripe CLI.

loud ledgeBOT
naive bridge
#

There are still API requests happening, and they should show up in your logs.

magic fog
#

which logs

naive bridge
magic fog
#

sorry if I sound ignorant

naive bridge
#

Your Dashboard logs.

magic fog
#

ok, this is for connected account

#

one moment

#

got it

#

req_vgYUno5zawsGmE

naive bridge
#

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.

magic fog
#

ok, advancing

#

Missing required param: features[subscription_update][default_allowed_updates].

faint dove
#

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_

magic fog
#

req_VU3EJMIpjOt8YZ

faint dove
#

Okay yes it lookes like you are missing the required parameter of what specific updates are allowed for subscriptions

magic fog
#

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?

faint dove
#

How did you create that portal session? What parameters did you specify?

magic fog
#

I am trying to allow the customer to update their payment method for that subscription

#

that is all i need

faint dove
#

I took a look at the portal link, I can update payment methods on it.

#

It looks like that does what you want

magic fog
#

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?

faint dove
#

Have you tested that yourself?

magic fog
#

No

faint dove
#

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

magic fog
#

Thanks a lot for your help all