I'm using Stripe's default form for payment processing. How can I add a coupon field? I've created a coupon, but I'm not sure how I would process the coupon code.
<form class="efocus" action="form_process.php?source=payment" method="post">
<input type="hidden" name="fee" value="1795">
<script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-amount=1795 data-description="Month-to-month Package">
</script>
</form>
Is this possible or do I need to build a custom form?
You can't Add a coupon Field to the Pop Up Form shown by using the stripe JS. Hopefully they will add this ability. It would be extremely helpful.
You can still add a the coupon code field between the form tags, but that field will not appear in the form that pops up. It will appear underneath the actual stripe checkout button.
<form class="efocus" action="form_process.php?source=payment" method="post">
<input type="hidden" name="fee" value="1795">
<script
src="https://checkout.stripe.com/v2/checkout.js"
class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-amount=1795 data-description="Month-to-month Package">
</script>
<input type="text" name="discount" value="YOUR_DISCOUNT_ID_HERE" />
</form>
This is definitely not ideal. Since there will now be an input field under the button. So you may want to code your own Stripe Form?
Anyone who tells you that you can add Fields to the POP up form, please get a link to where it says that in the documentation, or a link to any working example, demo, etc anywhere on the internet.
You can't add a coupon to Checkout. Checkout only creates the token to charge the customer. The coupon is applied when the token is returned to the server. Here's a code sample from stripe
stripe.Customer.create(
source=token,
plan="basic_monthly",
email="[email protected]",
coupon="coupon_ID"
)
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