#GamingForeverYT

1 messages · Page 1 of 1 (latest)

mossy widgetBOT
serene spade
#

hi

vapid coral
#

hmm, not sure what you mean. What is the value of your $product_price variable exactly?

that's not how our PaymentLinks work, you don't build them yourself by combining strings with variables, the whole link is static and something you get from the Stripe Dashboard or API

serene spade
#

so its a variable that has the id

vapid coral
#

hmm yeah but that makes no sense?

serene spade
#

Yes

#

`use Stripe\Product;

include('config.php');
require_once('./assets/libs/stripe-php-10.1.0/init.php');

$stripe = new \Stripe\StripeClient(
'keyy'
);

$product = $stripe->products->create(
[
'name' => 'Basic Dashboard',
'default_price_data' => [
'unit_amount' => 1,
'currency' => 'eur',
],
'expand' => ['default_price'],
]
);

$product_id = $product->getLastResponse()->headers["Request-Id"];

$product_price = $product -> default_price -> id;

$product_link = $stripe->paymentLinks->create([
'line_items' => [
[
'price' => $product_price,
'quantity' => 1,
],
],

]);

header('Location: https://buy.stripe.com/<$product_price>');`

#

that is my code

#

but i dont know how to set a varible in a link so the id will be automatic there

vapid coral
serene spade
#

thanks

serene spade
vapid coral
#

ah yeah, it's PHP

serene spade
#

indeed

#

hha

vapid coral
#

header('Location: ' . $product_link->url); I think to concat strings in PHP (uses a .) you're the PHP dev so probably know more

serene spade
#

It works 😄

#

i have a other question qlso

vapid coral
#

sure, what's up?

serene spade
#

How can i set the payment methode? only on 1

#

example bancontact

#

`$product_link = $stripe->paymentLinks->create([
'line_items' => [
[
'price' => $product_price,
'quantity' => 1,
],
],

]);`

vapid coral
serene spade
#

Yeah

#

but i want

#

that

#

if they press on bancontact on the site

#

they can only pay with bancontact

#

if they press on ideal they can only pay with ideal

#

so i want to set in the code

#

that you can pay with that

vapid coral
serene spade
#

okay thanks

#

heum

#

how can i intergrade it in the code?

#

sorry

#

xD

vapid coral
#

what have you tried?

serene spade
#

nothing becouse i dont know where and how to add it

#

there is no example

vapid coral
#

that's why we have docs and a test mode really, so you can try it

#

anyway

#

to save you time, it's 'payment_method_types'=> ["bancontact"],

serene spade
#

Thanks

vapid coral
#

but do try it yourself before just asking, it's straightforward and you'll learn more about coding and Stripe by trying!

serene spade
#

hi

serene spade
#

this is good right?

#

becouse it give me for this no error

#

) The Checkout Session's total amount due must add up to at least €0.50 eur

#

i get that error

gilded cipher
#

Hi! I'm taking over this thread.

#

The Checkout Session's total amount due must add up to at least €0.50 eur
The total for a Checkout Session must be at least 0.50€, otherwise it won't work. So it looks like your total is too low.

gilded cipher
serene spade
#

automatically

gilded cipher
#

You create a new price.

#

You can't change the amount of an existing price.