对于租赁公司,我们需要设置延期付款。
当用户租用元素时,我们必须在他的信用卡上锁定 25 美元(押金)。 他将被收取每小时 1 美元的费用。如果他在 5 小时内返回,他将被收取 5 美元。 25 小时后,我们认为该元素丢失,并按全价收取 25 美元。
在客户付款验证时,我们应该出示 1 美元的账单(而不是 25 美元的账单)。
我们通过 pkdeferredpaymentsummaryitem
在 Apple Pay 上实现了这一点。
您知道如何使用 Stripe Pay 实现这一点吗?
目前这里是我们的代码:
public PaymentIntent createCapturePaymentIntent(String amount, String currency, String customerId,
String paymentMethodId, String description) throws Exception {
Map < String, Object > params = new HashMap < > ();
params.put("amount", amount);
params.put("currency", currency);
params.put("customer", customerId);
if (null != paymentMethodId) {
params.put("payment_method", paymentMethodId);
}
params.put("description", description);
// params.put("confirm", "true");
params.put("capture_method", "manual");
LoggerHelper.mdc("stripe", "createCapturePaymentIntent body ==> {}", JacksonUtils.toJson(params));
PaymentIntent paymentIntent = null;
try {
paymentIntent = PaymentIntent.create(params, requestOptions);
} catch (CardException e) {
LoggerHelper.mdc("stripe", "createCapturePaymentIntent error ==> {}: {}", e.getCode(), e.getMessage());
String paymentIntentId = e.getStripeError().getPaymentIntent().getId();
paymentIntent = PaymentIntent.retrieve(paymentIntentId, requestOptions);
}
LoggerHelper.mdc("stripe", "createCapturePaymentIntent result ==> {}", JSON.toJson(paymentIntent));
return paymentIntent;
}
但是用户看到的是 25 美元的钞票而不是 1 美元的钞票:
Apple Pay Documentation: pkdeferredpaymentsummaryitem
编辑:您认为通过将选项 setup_future_usage
设置为 off_session
来创建 $1 付款是否是实现我们目标的好主意?
最佳答案
由于您的客户同意您的特定条款和条件,您的应用 UI 可以在前端显示 1 美元,而在后台时,您将扣除全部 25 美元。如果 stripe 没有执行此操作的 API 方法,这应该可以解决此问题
https://stackoverflow.com/questions/73694872/
相关文章:
xcode - 错误构建 : Command PhaseScriptExecution failed
c# - 在不跳过 OutputFormatter 的情况下捕获异常并使用自定义消息进行响应
python - pytorch 闪电 "got an unexpected keyword arg
android - 在 Jetpack Compose 中使用 HorizontalPager
.net - 如何写入 Windows 事件查看器应用程序 channel ? (。网)