#stan_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/1308788481996095490
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Is your feature request related to a problem? Please describe. Hello, we are trying to implement "shipping rate requests by server" using this guide https://docs.stripe.com/payments/check...
hi! it's a private beta so part of that will be we don't have all the docs ready. It's pretty easy to convert the example though, what have you tried?
like
permissions: {
update: {
shipping_details: 'server_only',
}
},
in our PHP library would be
'permissions' => ['update'=>['shipping_details'=>'server_only']]
you just turn the { to [ and use => instead of : for PHP
hello, i had only tried the PHP SDK yet, but i am about to rewrite the implementation into PHP's CURL to be able to surpass the limitations of the SDK. The most important information here is if it's worth for me to rewrite it, or if to suggest client to wait a few weeks for this to get into there
yes, i'e used hte 'permissions' and it seems that the PHP SDK returns exception "Received unknown parameter: permissions"
that's not the SDK that would return that error, that's the backend API
you get that error because the account you're using is not in that beta, I would say.
If you have the request ID req_xxx from the error I can confirm if that's the case.
this is the initialization:
$stripe = new \Stripe\StripeClient($private_key, [
'apiVersion'=> '2024-10-28.acacia; checkout_server_update_beta=v1',
]);
$session = $stripe->checkout->sessions->create([
'ui_mode' => 'embedded',
'permissions' => [
'update'=> [
'shipping_details'=>'server_only'
]
],
'line_items' => [
[
'price_data' => [
'product_data' => [ 'name' => 'Test Item' ],
'currency' => 'gbp',
'unit_amount' => 1000
],
'quantity' => 2,
],
],
'return_url' => $return_url,
'mode' => 'payment',
]);
ok, so if we request the account to be in beta - will this influence normal operations as well ?
i don't have the req ID - do you know how to get it from the PHP Stripe SDK ? (i.e. how to get raw response )
i originally thought that "account in beta" is a matter of SDK initialization of
$stripe = new \Stripe\StripeClient($private_key, [
'apiVersion'=> '2024-10-28.acacia; checkout_server_update_beta=v1',
]);
vs
$stripe = new \Stripe\StripeClient($private_key);
the request ID is usually just logged as part of the exception
but overall that code looks fine , and the issue is just that your account does not have access to that beta (which is why you have to use the call-to-action link on https://docs.stripe.com/payments/checkout/custom-shipping-options ). Just passing the header in the API-Version doesn't give you access
"request_log_url": "https://dashboard.stripe.com/test/logs/req_QgNvYVOLCgrzfW?t=1732110538",
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
i think it's req_QgNvYVOLCgrzfW
ok i think you mean this link, thank you very much
(i haven't noticed it )
can i please ask another question - will this API (ie requesting shipping methods) be available on other Stripe's APIs such as Element or Express Checkout ?
well, the most likely outcome is we will release https://docs.stripe.com/checkout/custom-checkout , which lets you use Elements, but with the functionality of Checkout to 'manage' the flow, and as part of that then one day it will probably be possible.
To be clear you can technically build all this using Elements today, since you'd just be creating a raw PaymentIntent with a set amount and can implement your own UI and address fields to determine how to set the amount inclusive of shipping
well, as far as i understand the Elements API is missing callback for "onShippingAddressChanged" since our customers "might start" express button as anonymous and to calculate the shipping rates (and/or taxes, etc) we'd need their Address - without this the payment should not be possible
right now we use Elements for "order total due" at the main checkout which does the shipping calculation before the Elements is initialized
yeah it's harder, but you can use something like https://docs.stripe.com/payments/finalize-payments-on-the-server?platform=web where you can view details of the PaymentMethod such as the address etc before creating and confirming the PaymentIntent for a calculated amount. But yeah there aren't great/simple solutions here today, it will get better with more functionality we're building over time.
ok, i'll try this approach as well - do you think it would work to update the PaymentIntent with own shipping options
inside
const addressElement = elements.create('address', options);
addressElement.on('change', (event) => {
if (event.complete){
...
thanks for useful inputs
our goal is exactly this (a competitor's shopify app):
using Stripe...
PaymentIntents don't really have any shipping options, they're purely just "charge $x amount", they don't have line items or breakdowns or so on(our other products like Checkout and Invoices are built on top of that).
Those line items in the Apple Pay payment sheet are already supported, you can do them via https://docs.stripe.com/elements/express-checkout-element/accept-a-payment#handle-click-event in the ExpessCheckoutElement. Unfortunately we don't really support that when using Apple/Google Pay inside the PaymentElement today.