#zoolle_api

1 messages ¡ Page 1 of 1 (latest)

hazy totemBOT
#

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

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

visual flume
edgy horizon
#

but in documentation is saying that can be set to always only for Subscriptions

#

this is not a subscription

visual flume
#

Dependong on how you're creating the Payment Link, there's either a checkbox in the Dashboard or an API parameter to pass

edgy horizon
#

// Attempt to create a payment link using Stripe's paymentLinks API
const paymentLink = await stripe.paymentLinks.create({
line_items: [
{
price: price, // Use the price parameter for the line item
quantity: 1, // Quantity is set to 1 for a single item
},
],
payment_method_collection: 'always',
});

#

this is what I am doing

#

but also the documentation is saying Can only be set in subscription mode. Defaults to always.

visual flume
#
edgy horizon
visual flume
#

That is not relevant at all

edgy horizon
#

ok

visual flume
#

Related to subscription links if there's no immediate payment, like a trial. You can let them 'pay' without collecting a card

edgy horizon
#

lets run a test with new properties in

visual flume
edgy horizon
#

StripeInvalidRequestError: payment_method_collection can only be used if the payment link contains recurring prices.

visual flume
#

Why are you passing that parameter? I never said to pass that

edgy horizon
#

/**

  • Creates a payment link using Stripe's API with the specified price.

  • @async

  • @function createPaymentLink

  • @param {string} price - The Stripe price ID or price amount to be charged.

  • @returns {Promise<Object>} An object containing the payment link ID and URL.

  • @throws {Error} Will throw an error if the Stripe API call fails.
    */
    export const createPaymentLink = async (price: string) => {
    try {
    // Attempt to create a payment link using Stripe's paymentLinks API
    const paymentLink = await stripe.paymentLinks.create({
    line_items: [
    {
    price: price, // Use the price parameter for the line item
    quantity: 1, // Quantity is set to 1 for a single item
    },
    ],
    payment_method_collection: 'always',
    payment_intent_data: { setup_future_usage: 'off_session' },
    });

    // Return the payment link ID and URL for further use
    return {
    id: paymentLink.id,
    url: paymentLink.url,
    };
    } catch (error) {
    // Log the error for debugging and troubleshooting purposes
    console.log(error);

    // Throw a new error with the original error message for higher-level handling
    throw new Error(error.message);
    }
    };

#

this is how my function looks like now

visual flume
#

You need to add customer_creation: 'always'

edgy horizon
#

ok lets try once again

#

ok this time seem to work fine

#

thank you very much for the help

visual flume
#

No problem, glad I could help!