#papix_checkout-sessions
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1247447064082780180
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hi there, are you using PaymentLinks?
https://docs.stripe.com/payment-links/customize#customize-checkout-with-url-parameters there are the parameters that you can prefill. However, you can't prefill custom fields yet.
it's very important for me use the special parameter
Yes, i use PaymentLinks (donate)
Then you should consider using Checkout sessions, which allows you to set default value for customer fields https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-custom_fields-text-default_value
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'd suggest you to check the API reference that I shared earleir.
i just want one way for can use parameter
I don't quite understand, can you rephrase the question?
I just need a solution to be able to auto-fill custom fields
I believe I have already told you how to achieve it with checkout sessions API, have you tried it out?
but with checkout sessions i need do in my server or work in normal link?
Yes you need to setup a server to create server-side API calls.
sure, after in callback i can get the special field too?
You mean if you can get the values of custom fields from the Checkout session API response?
yes, i create one donation system when the costumers do donations get coins in one game
Yes you can. see https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-custom_fields
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ups
one litle question
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => '{{PRICE_ID}}',
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/success.html',
'cancel_url' => $YOUR_DOMAIN . '/cancel.html',
]);
you can redirect this to my donate link?
You mean use you own domain? https://docs.stripe.com/payments/checkout/custom-domains#add-your-custom-domain
i want create the sesson and redirect to my link page
What is your "link page" ?
Hey! Taking over for my colleague.
This is Stripe hosted page and not yours
what you want to achieve exactly ?
hi mate
After creating a Checkout Session, what you want to achieve exactly ?
i need only add new fields here:
\Stripe\Stripe::setApiKey($stripeSecretKey);
header('Content-Type: application/json');
$YOUR_DOMAIN = 'http://localhost';
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => 'price_1PNsUUFwj18aV5R2doWHPSl7',
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/success.html',
'cancel_url' => $YOUR_DOMAIN . '/cancel.html',
]);
// header("HTTP/1.1 303 See Other");
// header("Location: " . $checkout_session->url);
die('<meta http-equiv="refresh" content="0;url='. $checkout_session->url .'">');
You are looking for this?
https://docs.stripe.com/payments/checkout/custom-fields
i want add default value and do disable input
i want add default
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-custom_fields-text-default_value
do disable input
You can't disable the input... in that case just add it as metadata
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i just need help how i can add metadata in my code
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => 'price_1PNsUUFwj18aV5R2doWHPSl7',
'quantity' => 1,
]],
'custom_fields' => [
[
'key' => 'username',
'label' => [
'type' => 'custom',
'custom' => 'Username (Login)',
],
'type' => 'text',
'text' => [
'default_value' => $username,
],
],
],
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/success.html',
'cancel_url' => $YOUR_DOMAIN . '/cancel.html',
]);
you add at the root level of the request metadata=>['key'=>'value']
same level with line_items, custom_fields, mode...
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
something like this?
'metadata' => [[
'username' => 'disabled',
]],
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => 'price_1PNsUUFwj18aV5R2doWHPSl7',
'quantity' => 1,
]],
papix_checkout-sessions
Hi mate
i need disable the input (html) in:
'custom_fields' => [
[
'key' => 'username',
'label' => [
'type' => 'custom',
'custom' => 'Username (Login)',
],
'type' => 'text',
'text' => [
'default_value' => $username,
],
],
],
i try this but dont work
you can't disable the input of a custom field
in html it's like just add the tag "disabled" in html
I agree, but we don't have the functionality
i see websites using stripe and do this
<input type="text" name="username" id="username" class="form-control" placeholder="<?php text($_SESSION['username']); ?>" maxlength="16" disabled>
i need add: disabled in the input
I understand but that can be added when using PaymentElement not the hosted Checkout Session
sure let me know if you need any more help
and for example if i want auto field the default "email"?
you can pass customer_email