#papix_checkout-sessions

1 messages ยท Page 1 of 1 (latest)

low lavaBOT
#

๐Ÿ‘‹ 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.

thorn zealot
#

Hi there, are you using PaymentLinks?

gleaming remnant
#

it's very important for me use the special parameter

#

Yes, i use PaymentLinks (donate)

thorn zealot
gleaming remnant
#

you have one example page in php?

#

i want the same layout

thorn zealot
#

I'd suggest you to check the API reference that I shared earleir.

gleaming remnant
#

i just want one way for can use parameter

thorn zealot
#

I don't quite understand, can you rephrase the question?

gleaming remnant
#

I just need a solution to be able to auto-fill custom fields

thorn zealot
#

I believe I have already told you how to achieve it with checkout sessions API, have you tried it out?

gleaming remnant
#

but with checkout sessions i need do in my server or work in normal link?

thorn zealot
#

Yes you need to setup a server to create server-side API calls.

gleaming remnant
#

sure, after in callback i can get the special field too?

thorn zealot
#

You mean if you can get the values of custom fields from the Checkout session API response?

gleaming remnant
#

yes, i create one donation system when the costumers do donations get coins in one game

thorn zealot
gleaming remnant
#

sure ty!

#

have a good day

gleaming remnant
#

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?

thorn zealot
gleaming remnant
#

i want create the sesson and redirect to my link page

thorn zealot
#

What is your "link page" ?

low lavaBOT
gleaming remnant
random lynx
#

Hey! Taking over for my colleague.

random lynx
#

what you want to achieve exactly ?

gleaming remnant
#

hi mate

random lynx
gleaming remnant
#

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 .'">');
random lynx
gleaming remnant
#

Oh, perfect

#

ty

#

and now how i can auto complete the element?

gleaming remnant
#

i want add default value and do disable input

random lynx
gleaming remnant
#

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',
]);
random lynx
#

you add at the root level of the request metadata=>['key'=>'value']

#

same level with line_items, custom_fields, mode...

low lavaBOT
atomic mural
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

gleaming remnant
#

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,
  ]],
low lavaBOT
#

papix_checkout-sessions

gleaming remnant
#

i need disable the input (html) in:

  'custom_fields' => [
    [
      'key' => 'username',
      'label' => [
        'type' => 'custom',
        'custom' => 'Username (Login)',
      ],
      'type' => 'text',
      'text' => [
        'default_value' => $username,
      ],
    ],
  ],
gleaming remnant
atomic mural
#

you can't disable the input of a custom field

gleaming remnant
#

in html it's like just add the tag "disabled" in html

atomic mural
#

I agree, but we don't have the functionality

gleaming remnant
#

i see websites using stripe and do this

atomic mural
#

would you mind sharing any?

#

this way I could see what you're referring to

gleaming remnant
#
<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

atomic mural
#

I understand but that can be added when using PaymentElement not the hosted Checkout Session

gleaming remnant
#

oh ok bro

#

ty

#

have a good day

atomic mural
#

sure let me know if you need any more help

gleaming remnant
#

and for example if i want auto field the default "email"?

atomic mural
#

you can pass customer_email

gleaming remnant
#

bro it's this!

#

when you send the email in parameter you get auto "disabled input"

#

i want the same for username

atomic mural
#

we don't offer this for custom fields

#

and please refrain from using slang such as bro!