#yomapi_best-practices

1 messages ¡ Page 1 of 1 (latest)

gritty flowerBOT
#

👋 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/1337296811752165426

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

uneven stream
#

hello! The PaymentIntent itself doesn't have a parameter that points to the Checkout Session. However, you can pass the metadata in the Checkout Session such that it's reflected in the underlying PaymentIntent.

If you pass in the metadata in https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata, only the Checkout Session object will contain the metadata.

If you pass in the metadata into payment_intent_data.metadata (this is for mode="payment") - the PaymentIntent will contain that metadata : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata

Reference: https://docs.stripe.com/metadata#set-indirectly

Learn how to use metadata to save additional information.

still zinc
#

Thansk for fast asnwer!

so It should be like this...

import com.stripe.param.checkout.SessionCreateParams;
import java.util.HashMap;
import java.util.Map;

Map<String, String> metadata = new HashMap<>();
metadata.put("orderId", "12345");
metadata.put("customerEmail", "customer@example.com");

SessionCreateParams params = SessionCreateParams.builder()
.setMode(SessionCreateParams.Mode.PAYMENT)
.setSuccessUrl(successUrl)
.setCancelUrl(cancelUrl)
.addAllLineItem(lineItems)
.setPaymentIntentData(
SessionCreateParams.PaymentIntentData.builder()
.putAllMetadata(metadata)
.build()
)
.build();

uneven stream
#

looks correct at a quick glance, I'll recommend running it and making payment to see if it works as expected

still zinc
#

Ok! thanks for answer!
I'm sorry for bothering you by asking something that was already in the document.