#krutarth-partial-payments
1 messages · Page 1 of 1 (latest)
code for the checkoutform:
import { useState } from 'react';
import {
AddressElement,
PaymentElement,
useStripe,
useElements,
} from '@stripe/react-stripe-js';
import { Typography } from '@mui/material';
export default function CheckoutForm() {
const stripe = useStripe();
const elements = useElements();
const [message, setMessage] = useState(null);
const [isProcessing, setIsProcessing] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
if (!stripe || !elements) {
return;
}
setIsProcessing(true);
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: `${window.location.origin}/completion`,
},
});
if (error) {
setMessage(error.message);
}
setIsProcessing(false);
};
return (
<>
<form id="payment-form" onSubmit={handleSubmit}>
<Typography
style={{ fontSize: '24px', fontWeight: 'bold', marginBottom: '15px' }}
>
Pay with card
</Typography>
<AddressElement
options={{
mode: 'billing',
allowedCountries: ['US'],
blockPoBox: true,
fields: {
phone: 'always',
},
validation: {
phone: {
required: 'always',
},
},
}}
/>
<PaymentElement id="payment-element" options={{ wallets: 'never' }} />
<button disabled={isProcessing || !stripe || !elements} id="submit">
<span id="button-text">
{isProcessing ? 'Processing ... ' : 'Pay'}
</span>
</button>
{message && <div id="payment-message">{message}</div>}
</form>
</>
);
}
Okay so you are using the Payment Element here
And you want to know if you can support partial payments? On what, an Invoice? A Payment Intent?
I am not completely sure but 99% it is payment intent
We do not support partial payment of a payment intent except when using the Bank Transfers payment method.
https://docs.stripe.com/payments/bank-transfers
This is where a customer send you funds directly from their bank account and we need to support flows where they send too much or not enough.
krutarth-partial-payments