#noorbl

1 messages ยท Page 1 of 1 (latest)

gray sluiceBOT
urban jewel
#

Hello

formal hollow
#

Hi

urban jewel
#

Not sure what you mean exactly

#

Can you explain more?

formal hollow
#

wait

#

i mean i want after payment send invoice to email customre

#

example

#

hello>?

#

are you here

urban jewel
#

I'm helping multiple folks at once so you need to be patient

formal hollow
urban jewel
#

An Invoice receipt email will be sent to customers automatically if you enable it in your Dashboard

#

These receipts aren't sent in test-mode though so as to not spam people

#

However you can trigger them manually to see what they look like

formal hollow
#

ok

#

but in code
?

#

form code?

#

const CheckoutForm: React.FC<CheckoutFormProps> = ({
clientSecret,
handleSetPaymentSuccess,
}) => {
const { cartTotalAmount, handleClearCart, handleSetPaymentIntent } =
useCart();
const stripe = useStripe();
const elements = useElements();
const [isLoading, setIsLoading] = useState(false);
const formattedPrice = formatPrice(cartTotalAmount);

useEffect(() => {
if (!stripe) {
return;
}
if (!clientSecret) {
return;
}
handleSetPaymentSuccess(false);
}, [stripe]);

const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();

if (!stripe || !elements) {
  return;
}

setIsLoading(true);

stripe
  .confirmPayment({
    elements,
    redirect: "if_required",
  })
  .then((result) => {
    if (!result.error) {
      toast.success("Checkout Success");

      handleClearCart();
      handleSetPaymentSuccess(true);
      handleSetPaymentIntent(null);
    }

    setIsLoading(false);
  });

};

return (
<form onSubmit={handleSubmit} id="payment-form">
<div className="mb-6">
<Heading title="Enter your details to complete checkout" />
</div>
<h2 className="font-semibold mb-2">Address Information</h2>
<AddressElement options={{
mode: 'shipping',
allowedCountries: ['*'],
blockPoBox: false,
fields: {
phone: 'always',
},
validation: {
phone: {
required: 'always',
},
},
}} />
<h2 className="font-semibold mt-4 mb-2">Payment Information</h2>
<PaymentElement id="payment-element" options={{ layout: "tabs" }} />
<div className="py-4 text-center text-slate-700 text-xl font-bold">
Total: {formattedPrice}
</div>
<Button
label={isLoading ? "Processing" : "Pay now"}
disabled={isLoading || !stripe || !elements}
onClick={() => {}}
/>
</form>
);
};

urban jewel
#

Are you creating one-time Invoices

#

Or Subscriptions?

formal hollow
#

creating one-time Invoices

#

An online store website, not a subscription website

#

?

urban jewel
formal hollow
#

where the code?

urban jewel
#

Not sure what you mean by that

#

After the confirmation client-side there is a Charge created

#

It is associated to the PaymentIntent

formal hollow
#

and how to rquest email in form?

urban jewel
#

You would collect that yourself

formal hollow
formal hollow
urban jewel
#

Yeah Address Element and Payment Element won't collect email for card payments (it is only required for certain payment method types in which case it will be collected) -- this means you add your own input to the form to collect email if you want that from your customer.

formal hollow
#

here show

formal hollow
urban jewel
#

A link about what?

formal hollow
#

for add rquest email? for send invoice ๐Ÿ™‚

urban jewel
formal hollow
#

ok

#

thanks :)\