I'm trying to customize the stripe checkout form but I have no idea of how to add an input. I would like to add "phone number" and "name" to create a charge AND a customer. Do you have any idea of how I can do this?
<form action="paiement.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-zip-code="true"
data-key="pk_test_uYSRAdQpdYgrGLiyrkNA3EjA"
data-amount="999"
data-name="Demo Site"
data-description="Example charge"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-currency="eur"
>
</script>
</form>
This is the code that I'm supposed to customize.
You wont be able to implement those custom fields with the Stripe checkout method. According to the docs here: https://stripe.com/docs/checkout - there are no optional or mandatory fields you can add.
You'll need to use https://stripe.com/docs/stripe-js in order to implement a custom form, process the payments on a backend, and handle the customer / charges via Stripe API. This can be done by standard HTML with your choice of backend language to process the charges and customers.
To learn how to create charges: https://stripe.com/docs/api#charges
To learn how to create customers: https://stripe.com/docs/api#customers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With