#nick_code
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/1276391403525505095
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nick_code, 14 hours ago, 3 messages
Hi there, can you share with me the code you wrote?
Sure thing.
try {
const successUrl = 'www.mywebsite.come/successpage.html?status=success';
const cancelUrl = 'www.mywebsite.come/failpage.html?status=failed';
let bodyData = selectedItems.map((item, index) => {
return `line_items[${index}][price]=${encodeURIComponent(item.price)}&line_items[${index}][quantity]=${item.quantity}`;
}).join('&');
const response = await fetch("https://api.stripe.com/v1/payment_links", {
method: "POST",
headers: {
Authorization: `Bearer SECRET KEY`,
"Content-Type": "application/x-www-form-urlencoded",
},
body: `allow_promotion_codes=true&${bodyData}&success_url=${encodeURIComponent(successUrl)}&cancel_url=${encodeURIComponent(cancelUrl)}`,
});
And what error did you get?
"Received unknown parameters: success_url, cancel_url"
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
https://docs.stripe.com/api/payment-link/create also I'd suggest you refer to this API refernece to the acceptable params. PaymentLink creation API doesn't accept success_url and cancel_url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
parameter_unknown - success_url
Received unknown parameters: success_url, cancel_url
Was this useful?
Yes
No
{
"allow_promotion_codes": "true",
"cancel_url": "https://x822fj.csb.app/logindashboard.html?status=failed",
"line_items": {
"0": {
"price": "price_1Pq4fGBz5J8GQjjcNKL3jppK",
"quantity": "1"
}
},
"success_url": "https://x822fj.csb.app/loadingpage.html?status=success"
}
Response body
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameters: success_url, cancel_url",
"param": "success_url",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_C4HsOuR8lNjSCL?t=1724385645",
"type": "invalid_request_error"
}
}
Request POST body
{
"allow_promotion_codes": "true",
"cancel_url": "https://x822fj.csb.app/logindashboard.html?status=failed",
"line_items": {
"0": {
"price": "price_1Pq4fGBz5J8GQjjcNKL3jppK",
"quantity": "1"
}
},
"success_url": "https://x822fj.csb.app/loadingpage.html?status=success"
}
idk if thats what u need
Or maybe you want to create a checkout session? because success_url and cancel_url are the params for checkout session? See https://docs.stripe.com/api/checkout/sessions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and whats the difference between the 2?
Can you tell me what you want to achieve so that I can advise most suitable solution for you?
The details about payment links and checkout can be found here
https://docs.stripe.com/payment-links
https://docs.stripe.com/payments/checkout