#akrabulislam

1 messages ยท Page 1 of 1 (latest)

glossy hornetBOT
fresh ledge
#

Did you pass a customer?

dire dagger
#

From where we need to pass the customer?

fresh ledge
#

Recommend reading that description to understand

dire dagger
#

But int the response I can see "customer": null,

fresh ledge
#

Did you read above

dire dagger
#

I read it but I am getting any clue and solution of getting the customer . The customer field should have an ID

fresh ledge
#

Can you share the request id for creating the session then

dire dagger
#

where do I get the session id

fresh ledge
#

Starts with cs_

#

You're looking at the session object right now to see customer is null right?

#

It should be at the top of that

dire dagger
#

okay let me check

#

cs_test_a1ge7t8dH42O5ZKTQXZICf0BMFvh3KGkXr0fsfc51uHOWpLTQUSr1dXGwq

fresh ledge
#

Oh this is a payment link session

#

You have customer_creation set to if_required on the payment link

#

You need to set it to always

dire dagger
#

Where can I set it always , because I have created the payment link from my dashboard and use it in the frontend just

#

or shall I need to call this function when triggering in the payment button from the UI

fresh ledge
#

Hm it doesn't look like you can set this via the dashboard

dire dagger
#

Got the point thank you

#

let me try it out

glossy hornetBOT
dire dagger
#

encountered this error

#

when trying to call the api for so that every time create a new customer

leaden walrus
#

Hi ๐Ÿ‘‹

The URL used in this request was /v1/payment_links/https%3A%2F%2Fbuy.stripe.com%2Ftest_7sI6oo1R60u77e0144. Can you log the URL before making the request?

dire dagger
#

def modify_payment_link(self):
        try:
            stripe.PaymentLink.modify(
                "https://buy.stripe.com/test_7sI6oo1R60u77e0144",
                active=False,
            )
            return wrap_response({'message': 'Updated'}, 200)

        except stripe.error.StripeError as e:
            # Handle any Stripe API errors here
            print(f"Stripe Error: {e}")
            return wrap_response({'error': e}, 500)

#

This is hard coded

leaden walrus
dire dagger
#

def modify_payment_link(self):
        try:
            stripe.PaymentLink.modify(
                "plink_1NqeLUGfBsqAl5dJvyhq2fYj",
                active=False,
            )
            return wrap_response({'message': 'Updated'}, 200)

        except stripe.error.StripeError as e:
            # Handle any Stripe API errors here
            print(f"Stripe Error: {e}")
            return wrap_response({'error': e}, 500)

stripe.error.InvalidRequestError: Request req_yZIx6pBcNBn40H: No such payment link: 'plink_1NqeLUGfBsqAl5dJvyhq2fYj'

#

From the documentation this is generated based on my api key so I think it should be correct. Is there a way to get this plink from my dashboard

leaden walrus
#

If you go to your Stripe Dashboard you can drop the ID in the top search bar. However I don't see a payment link with that ID on my end either

dire dagger
#

Yes I am not getting any result

#

what shall I do now?

leaden walrus
#

Okay and you are sure this Payment Link exists? Do you have the API request that created it?

dire dagger
#

Yes I have 2 payment link . I just created one now

#

but why I can't see anything related to that starts with plink_

leaden walrus
#

Okay what happens when you select one in particular?

#

Okay they make it hard to find this. I just found my own

#

I went to my list of Payment Links, the clicked on a single row to get to the detail page for that Payment Link. Still no ID. But at the bottonm of the detail page is a link the Request Log where I created the Payment Link. When I clicked on that I can see the API request and response when the Payment Link was created. You can find the actual ID in the Response body

dire dagger
#

Thank you I got it. And called successfully the API

leaden walrus
#

Great ๐ŸŽ‰

dire dagger
#

Now the customer should be created in each checkout session and will get the customer value in the event response. Is it correct?

leaden walrus
dire dagger
#

You can see the first customer is not guest. It has a customer id (cus_OdxEjG7vdib6QA). But when I am pay with this email in the event checkout.session.completed I am still getting the customer properly null

leaden walrus
#

Can you share the event ID?

dire dagger
#

evt_3NqfMgGfBsqAl5dJ1gbyx6Kr

leaden walrus
#

In the Payment Link this is set : customer_creation: "if_required",

#

That will not create a Customer if it isn't required

dire dagger
#

import stripe
stripe.api_key = "sk_test_51NqUYyGfBsqAl5dJCdubKkssjlyHO1lfDULM84LJqkuSQXrlO0RnKmXHDbePQ13KQlrseFgVYAqcdjIKf8BaT20d00zTjMJw1Z"

stripe.PaymentLink.modify(
  "plink_1NqfdkGfBsqAl5dJmTtYvmcm",
  active=False,
)

#

I changed the key values with mine

#

But this call succeeded

#

Let me try again

#

GIve me a min maybe I do I thing wrong

fiery anvil
#

๐Ÿ‘‹ hopping in since snufkin has to head out soon - let me know when you need any more help from us

dire dagger
#

Thank you so much for the help. We were able to fix it and hopefully now we will sort it out. WIll let you know if we need any more help