#zig.balthazar
1 messages · Page 1 of 1 (latest)
you would just use mode:subscription and pass two line_items, one is a recurring Price(the $100), and the other is a non-recurring Price for $30
I have done this and added two items to the line_items, but the result was as follows:
I want the user to pay only $30 for the first time on the checkout page, and $100 in the subsequent months. However, in the image above, it deducts $30 and $100 as two separate items from the user for the first time, and only deducts $100 in the following months.
then I would say keep it the same but add a one-time coupon for $100 off
const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
discounts:[{coupon:"Q90ztQlv"}],
line_items: [
{price: "price_1NGJ9CJoUivz182DDiWBdXEt", quantity: 1},
{price: "price_1NGJ9UJoUivz182D7e97U2QP", quantity: 1},
],
mode: 'subscription',
});
it deducts $30 and $100 as two separate items from the user for the first time
to be clear, it charges them the "total due today" as one combined payment(that's what happens when they complete the Checkout form), and then for subsequent recurring payments, the recurring Price is what is charged, in case that was not clear
I understand that due to the system's implementation logic, you cannot use a coupon in this scenario.
However, according to the documentation, it states: "For subscription mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. Line items with one-time Prices will be on the initial invoice only."
Regarding the image you provided, I must clarify that the initial amount to be charged from the user is dynamic and determined after calculation, so it is not possible to use a discount code or similar in this case.
there isn't really another easy approach then
I need to implement something similar to the following:
{
quantity: 1,
price_data: {
currency: 'usd',
product: 'pro_vnjsdnvslj',
unit_amount: 3000,
},
}
This means that in this invoice, $30 should be deducted from the user, and then the user should be charged based on the prices defined in the product.
you can create a coupon dynamically in the API for a specific amount as part of the process of setting up the session, I don't see what the problem there would be
I don't understand what you mean and how re-stating this changes the solution I already gave