#zoolle_api
1 messages ¡ Page 1 of 1 (latest)
đ 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.
Yes, you can't attach/save the card after the payment. It would need to be done during the payment, which Payment Links support: https://docs.stripe.com/payment-links/customize#save-payment-details-for-future-use
but in documentation is saying that can be set to always only for Subscriptions
this is not a subscription
Dependong on how you're creating the Payment Link, there's either a checkbox in the Dashboard or an API parameter to pass
// 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.
OK, then pass these parameters as well:
customer_creation: 'always': https://docs.stripe.com/api/payment-link/create#create_payment_link-customer_creationpayment_intent_data[setup_future_usage]: 'off_session': https://docs.stripe.com/api/payment-link/create#create_payment_link-payment_intent_data-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What documentation?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That is not relevant at all
ok
Related to subscription links if there's no immediate payment, like a trial. You can let them 'pay' without collecting a card
lets run a test with new properties in
If you do this, it'll work as you need
StripeInvalidRequestError: payment_method_collection can only be used if the payment link contains recurring prices.
Why are you passing that parameter? I never said to pass that
/**
-
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
Remove payment_method_collection
You need to add customer_creation: 'always'
ok lets try once again
ok this time seem to work fine
thank you very much for the help
No problem, glad I could help!