#likhith_api

1 messages ¡ Page 1 of 1 (latest)

gaunt orioleBOT
#

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

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

echo boughBOT
#

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.

edgy jasper
#

Hmm, looks like you want to use Checkout Sessions API, but why you call PaymentIntents API in your code?

lyric knot
#

sorry it should be checkout

edgy jasper
#

And where do you want to set the metadata to? the paymentIntet object or subscription object that the checkout session creates? or on the checkout session object itself?

lyric knot
#

paymentIntet object that checkout creates so that i can capture them for further process in webhook

edgy jasper
lyric knot
#

is this code correct

#

session = stripe.checkout.Session.create(
payment_method_types=['card'],
client_reference_id=transaction_id,
line_items=[{
'price_data': {
'currency': currency,
'product_data': {
'name': 'Student Package',
'metadata': {
'package_name': student_packages.package.name,
'transaction_id': transaction_id
},
},
'unit_amount': actual_amount,
},
'quantity': 1,
}],
mode='payment',
success_url=STUDENT_PACKAGE_CALLBACK_URL,
cancel_url=STUDENT_PACKAGE_CALLBACK_URL,
)

edgy jasper
#

No, the metadata should be set in payment_intent_data hash

lyric knot
#

is this the right way

#

session = stripe.checkout.Session.create(
payment_method_types=['card'],
client_reference_id=transaction_id,
line_items=[{
'price_data': {
'currency': currency,
'product_data': {
'name': 'Student Package',
},
'unit_amount': actual_amount,
},
'quantity': 1,
}],
payment_intent_data={
'metadata': {
'package_name': student_packages.package.name,
'transaction_id': transaction_id
}
},
mode='payment',
success_url=STUDENT_PACKAGE_CALLBACK_URL,
cancel_url=STUDENT_PACKAGE_CALLBACK_URL,
)

edgy jasper
#

Yes you are right

lyric knot
#

here i am not getting any info related to payment

edgy jasper
#

What's the event ID?

lyric knot
#

cs_test_a1xU2UzrYqHmaL87uOtUoF8WID5ph7VQx1qxystFQAUmNLCmkMZewt7uW7

edgy jasper
#

I mean the payment_intent.succeeded event that you are listening to.

gaunt orioleBOT
lyric knot
#

So instead of cli can't i hear the webhook through sites which offer webhook

tawny mulch
#

I don't understand your question. An event can be listened as long as your Webhook endpoint subscribes to the event type. For example, listening to payment_intent.succeeded event for the metadata on the Payment Intent

lyric knot
tawny mulch
#

Only when the endpoint is registered with Stripe, then Stripe will send the events

lyric knot
#

so does this end point need to be registered in dashboard, that if i am listening to an event in local webhook url i need to specify same local url in the dashboard too