#PSN-checkout-ad-hoc-price
1 messages · Page 1 of 1 (latest)
Hello! You'd want to use an 'ad-hoc' price via the price_data parameter: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yep, exactly! So you'd use price_data.unit_amount for the amount you wanted to charge: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-unit_amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you share your code I can help update it
session = stripe.checkout.Session.create(
success_url=success_url,
cancel_url=cancel_url,
payment_method_types=['card'],
mode='payment',
line_items=[{
'price': int(amount) * 100,
# For metered billing, do not pass quantity
'quantity': 1
}],
)
line_items=[{
'price_data': {
'unit_amount': int(amount) * 100,},
# For metered billing, do not pass quantity
'quantity': 1
}],
Like this?
Yeah, you can't pass an integer to the price parameter like that (it expects a Price object)
Yep, but you'll also need to pass product or product_data
