#nsad_api

1 messages ¡ Page 1 of 1 (latest)

frosty cedarBOT
pastel spireBOT
#

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.

frosty cedarBOT
#

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

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

proper dust
#

Can you elaborate what you mean by putting conditions in checkout?

Also, by "checkout" do you mean Stripe hosted checkout page?

molten edge
#

ok, for example, when have affiliate, need add parameters inside subscription_data

#

when dont have affiliate dont need to pass this parameter

proper dust
#

That's not a lot of detail as it doesn't really clarify how Stripe is involved here.

Also, can you clarify what APIs you're using exactly?

molten edge
#
        checkout_session = stripe.checkout.Session.create(
            payment_method_types=['card'],
            locale='pt-BR',
            line_items=[{
                'price': id,
                'quantity': 1,
            }],
            metadata={
                'user_id': request.user.pk,
                'product_id': product_id,
                'price_id': price_id,
            },
            mode='subscription',
            success_url=success_url,
            cancel_url=cancel_url,
            customer_email=request.user.email,
            subscription_data=subscription_data
        )
#

but i need make a condition in subscription_data

proper dust
#

You can't set a condition inside the subscription_data parameter. You'd need to do that outside of the API call. Like before you create a checkout session, you'd decide what data you need to pass to subscription_data and then send it to the API accordingly

molten edge
#

like a dict?

proper dust
#

That's upto you really

#

but yeah

molten edge
#

a ok, thanks!

#

have a nice day!