For a rental company, we need to set up deferred payment.
When a user rents an item we must lock $25 on his credit card (a deposit). He will be charged $1 per hour. If he returns his item within 5 hours, he will be charged $5. After 25 hours we consider the item lost and it is charged the full price $25.
At the time of the customer payment validation we should show a $1 bill (not a $25 bill).
We managed to implement this on Apple Pay with pkdeferredpaymentsummaryitem.
Do you have any idea how to implement this with Stripe Pay?
For the moment here is our code:
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;
}
But the user is shown a $25 bill instead of a $1 one:
Apple Pay Documentation: pkdeferredpaymentsummaryitem
Edit: Do you think creating a $1 payment with the option setup_future_usage set to off_session is a good idea to achieve our goal?
