#ebellotpu6_api

1 messages · Page 1 of 1 (latest)

ivory hollowBOT
thick zealotBOT
#

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.

ivory hollowBOT
#

👋 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/1273933254080335903

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

crimson lark
strange fox
#

but for example, I have created this plink_1PoMBOJjXBonDcGmYfNp3aMJ paymentLink

#

Then I open the url and completed a payment

#

If I retrieve again this payment link, where I can check that this has been payed?

#

can I assign any paymentintentId or something like that?

crimson lark
#

Well Payment Links are reusable so there's no notion of the link being 'paid' generally

#

As I said, the way to be notified of when there's a payment made via a Payment Link is via the checkout.session.completed event that fires. You'd setup a webhook to listen for those, and then trigger whatever logic you need there

strange fox
#

okey, I will try

#

but it seems complicated no?

crimson lark
#

Potentially, depends on your technical level and what exactly it is you need to do once you're recieved a payment

#

You could leverage a no-code tool like Zapier to handle those events instead of writing your own code

strange fox
#

When I recieve a payment, I want to update database status, no more

crimson lark
#

Then sounds like you need a webhook yep

strange fox
#

how do them works? I don't want to redirect the customer to any web page. I only want to send a url to the customer to pay and then update my db

crimson lark
#

There's no webpage involved. The webhook is an endpoint you create on your server/API that receives events from us async (in the background) and processes them to do logic as you need

ivory hollowBOT
strange fox
#

If I have more than one account, i need to create that for all of them?

ember bluff
#

in general yes(unless your multiple accounts are connected together in some marketplace setup with our Connect product)

strange fox
#

sorry, if I follow this steps and I have put a breakpoint in my webhook code, it would be break in some point?

#

stripe login
stripe listen --forward-to localhost:4242/webhook
stripe trigger payment_intent.succeeded

#

I have change the url to my api: localhost:5001/api/Webhook

ember bluff
#

remember that you need to have stripe listen running so it continues to forward events, you can't just execute it then close it and run stripe trigger; usually you use two terminal windows

#

and yes sure, if you have a debugger attached to your process and have a breakpoint and you process a webhook that would get hit

strange fox
#

in the dashboard I have seen that the listener is Disconnected

#

How can I connect it?

ember bluff
#

is stripe listen running in a terminal somewhere on your machine?

strange fox
#

I am getting this error now

ember bluff
#

any logs from your process running on port 5001?

strange fox
#

no, the breakpoint is not getting hit

ember bluff
#

I'd try to continue debugging it and add some more logs to see what's happening

#

also try just using curl or POSTMAN to POST data to your endpoint directly and confirm/deny if that works(to eliminate any issue with it being Stripe-specific versus an issue in your server)

strange fox
#

i can hit the breakpoint

#

but now i am getting this error:
Stripe.StripeException: 'Received event with API version 2022-11-15, but Stripe.net 40.8.0 expects API version 2022-08-01. We recommend that you create a WebhookEndpoint with this API version. Otherwise, you can disable this exception by passing throwOnApiVersionMismatch: false to Stripe.EventUtility.ParseEvent or Stripe.EventUtility.ConstructEvent, but be wary that objects may be incorrectly deserialized

#

this is my code:
[HttpPost]
public async Task<IActionResult> Handle()
{
var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
var webhookSecret = _configuration["StripeWebhookSecret"];

        try
        {
            var stripeEvent = EventUtility.ConstructEvent(json, Request.Headers["Stripe-Signature"], webhookSecret);

            if (stripeEvent.Type == Events.PaymentIntentSucceeded)
            {
                var paymentIntent = stripeEvent.Data.Object as PaymentIntent;

                // Actualiza tu base de datos aquí con los detalles del pago
                Console.WriteLine($"Pago exitoso: {paymentIntent.Id}");
            }

            return Ok();
        }
        catch (StripeException e)
        {
            return BadRequest(e.Message);
        }
    }
ember bluff
strange fox
#

okey. And this webhook will be hire every time a payment intent succeeded?

#

because i only want to manage the paymentintents payed using a paymentLink,

ember bluff
strange fox
#

and can I set some data to the paymentLink to identify which paymentLink has been payed completed in the webhook?

ember bluff
strange fox
#

okey, i am going to check

#

and is it posible to asign a customer to the paymentlink?

ember bluff
#

no(if that's what you need, don't use a PaymentLink, authenticate the user and directly create a CheckoutSession)

strange fox
#

okey, I will try with checkout sessions

ivory hollowBOT
strange fox
#

And the checkoutsession has a url to send it by email to the customer so he can complete the payment?

ember bluff
#

we don't usually recommend that; you would email the customer a link to your website, where you authenticate them, and then you redirect them to a CheckoutSession you create for that Customer cus_xxx

strange fox
#

this is not good for me...

tawdry summit
#

Why wouldn't it work?

strange fox
#

i have to create a new page just for login

#

for how long the session url expires?

tawdry summit
#

Checkout Session URLs are not designed to be sent via email.
It would require a simple endpoint on your server to do this properly: the customer clicks on a URL pointing to your app, the endpoint would generate a fresh Checkout Sessio URL and redirect the customer to Stripe Checkout. This way you don't need to worry about expiry. You don't need to build another page for this.

strange fox
#

okey, so I have to configure some paramater in the url that makes customer to login and then redirect to the checkout session?

tawdry summit
#

It depends on you. You can put parameters in the URL that you share that will identify the customer automatically.

strange fox
#

And why is the success_url required?

#

I don't want to redirect my customer to any page. Just show that his payment has been completed on checkout

#

Can I set this page

tawdry summit
#

Unfortunately Stripe Checkout doesn't support a hosted "success" page.

strange fox
#

I don't undertand how it can be so dificult to manage fail payments... I just want to send an email to my customers when they are not be able to complete a paymentintent, so they can retry the payment...

tawdry summit
tawdry summit
strange fox
#

because in this page, I use so many data that needs to get from previous pages..

#

and the customers needs to be loged in...

tawdry summit
#

In what cases do the failed payments occur on your own checkout?

strange fox
#

for example when customers needs to authenticate the payment method

#

or when they have insufficent funds

tawdry summit
#

Is it using card?

strange fox
#

yes

#

I have created an interface to retry payments in the same flow, but if the users close the page...

tawdry summit
#

Card errors will appear synchronously in the Payment Element, so you won't need to send the customer elsewhere.

#

users close the page
You can save the progreess of their order checkout on your side, and get them back to the payment page when they're back.

strange fox
#

dont' worry, we are not understanding...
I will try to change my checkout page to check if some parameters come from url and I will put the logic in there