Stripe 如何在使用 2 种支付方式时设置首选语言
Stripe how to set prefered language when using 2 payment methods
我在我的 Java 网络应用程序中成功集成了 Stripe 结帐。
到目前为止,付款方式是'card'。我想添加方法 'sofort' 可以添加此行 paymentMethodTypes.add("sofort")
.
Stripe.apiKey = retrieveKey("CLIENT_SECRET_KEY");
ArrayList<String> paymentMethodTypes = new ArrayList<>();
paymentMethodTypes.add("card");
params.put("payment_method_types", paymentMethodTypes);
ArrayList<String> images = new ArrayList<>();
ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
HashMap<String, Object> lineItem = new HashMap<>();
lineItem.put("name", title);
lineItem.put("images", images);
lineItem.put("amount", price);
lineItem.put("currency", "eur");
lineItem.put("quantity", 1);
lineItems.add(lineItem);
params.put("line_items", lineItems);
params.put("customer_email", email);
params.put("success_url", DOMAIN_URL);
params.put("cancel_url", DOMAIN_URL + "/cancel.xhtml");
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount(CONNECTED_ACCOUNT_ID).build();
session = Session.create(params, requestOptions);
现在如何设置我的首选语言?
我尝试将此行添加到我的代码中;没有成功。
PaymentIntentCreateParams.PaymentMethodOptions mtdh = PaymentIntentCreateParams.PaymentMethodOptions.builder().putExtraParam("sofort[preferred_language]", "de").build();
params.put("Payment_method_options", mtdh);
感谢您的帮助。
Stripe Checkout Sessions 不支持专门为 Sofort 设置首选语言(参见 the accepted properties for payment_method_options
in Stripe's documentation), but you can set the locale
for the entire Checkout Session。
以下是您在现有代码中的做法:
params.put("locale", "de");
我在我的 Java 网络应用程序中成功集成了 Stripe 结帐。
到目前为止,付款方式是'card'。我想添加方法 'sofort' 可以添加此行 paymentMethodTypes.add("sofort")
.
Stripe.apiKey = retrieveKey("CLIENT_SECRET_KEY");
ArrayList<String> paymentMethodTypes = new ArrayList<>();
paymentMethodTypes.add("card");
params.put("payment_method_types", paymentMethodTypes);
ArrayList<String> images = new ArrayList<>();
ArrayList<HashMap<String, Object>> lineItems = new ArrayList<>();
HashMap<String, Object> lineItem = new HashMap<>();
lineItem.put("name", title);
lineItem.put("images", images);
lineItem.put("amount", price);
lineItem.put("currency", "eur");
lineItem.put("quantity", 1);
lineItems.add(lineItem);
params.put("line_items", lineItems);
params.put("customer_email", email);
params.put("success_url", DOMAIN_URL);
params.put("cancel_url", DOMAIN_URL + "/cancel.xhtml");
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount(CONNECTED_ACCOUNT_ID).build();
session = Session.create(params, requestOptions);
现在如何设置我的首选语言? 我尝试将此行添加到我的代码中;没有成功。
PaymentIntentCreateParams.PaymentMethodOptions mtdh = PaymentIntentCreateParams.PaymentMethodOptions.builder().putExtraParam("sofort[preferred_language]", "de").build();
params.put("Payment_method_options", mtdh);
感谢您的帮助。
Stripe Checkout Sessions 不支持专门为 Sofort 设置首选语言(参见 the accepted properties for payment_method_options
in Stripe's documentation), but you can set the locale
for the entire Checkout Session。
以下是您在现有代码中的做法:
params.put("locale", "de");