#jacko-checkout
1 messages · Page 1 of 1 (latest)
hello! you can create adhoc prices on this parameter if you prefer : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
ok awesome
just making sure it is possible to use variable prices in the checkout session
before i dive down a rabbit hole
sorry @lyric mantle another question
import "./App.css";
const ProductDisplay = () => (
<section>
<div className="product">
<img
src="https://i.imgur.com/EHyR2nP.png"
alt="The cover of Stubborn Attachments"
/>
<div className="description">
<h3>Stubborn Attachments</h3>
<h5>$20.00</h5>
</div>
</div>
<form action="/create-checkout-session" method="POST">
<button type="submit">
Checkout
</button>
</form>
</section>
);
const Message = ({ message }) => (
<section>
<p>{message}</p>
</section>
);
export default function App() {
const [message, setMessage] = useState("");
useEffect(() => {
// Check to see if this is a redirect back from Checkout
const query = new URLSearchParams(window.location.search);
if (query.get("success")) {
setMessage("Order placed! You will receive an email confirmation.");
}
if (query.get("canceled")) {
setMessage(
"Order canceled -- continue to shop around and checkout when you're ready."
);
}
}, []);
return message ? (
<Message message={message} />
) : (
<ProductDisplay />
);
}
if i use this for my client
where it calls the server on ```<form action="/create-checkout-session" method="POST">
<button type="submit">
Checkout
</button>
</form>
can I pass in a variable for price?
sorry, i didn't quite understand that, what do you mean by variable for price?
@lyric mantle im using react for the client and I want to have the price be a variable that can change. So that the user can customize their price they will pay.
are you referring to the amount?
you want to allow the customer to choose how much they pay?
ah, alright, sorry about that, i misunderstood what you were looking for previously
looks like this is what you want? https://stripe.com/docs/payments/checkout/pay-what-you-want