jalendport/craft-stripecheckout

Request missing required body param

Closed this issue · 0 comments

Hello! I am testing Stripe Connect in a local dev environment with the following template code:

{% extends '_/layouts/purchase' %}

{% block content %}
<form action="" method="post">
  {{ csrfInput() }}
  {{ redirectInput('purchase/success') }}
  <input type="hidden" name="action" value="stripe-checkout/charge">

  {{ checkout({
      amount: 500
  }) }}
</form>
{% endblock content %}

This code will render the default Stripe "Pay With Card" button. When I click that button, I receive a 400 error:

yii\web\BadRequestHttpException: Request missing required body param in /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/craftcms/cms/src/web/Request.php:590
Stack trace:
#0 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/lukeyouell/craft-stripecheckout/src/controllers/ChargeController.php(37): craft\web\Request->getRequiredBodyParam('stripeToken')
#1 [internal function]: lukeyouell\stripecheckout\controllers\ChargeController->actionIndex()
#2 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#4 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('', Array)
#5 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('', Array)
#6 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('stripe-checkout...', Array)
#7 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application->runAction('stripe-checkout...', Array)
#8 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#9 /home/vagrant/sites/clients/wine30nyc.craft3.com/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#10 /home/vagrant/sites/clients/wine30nyc.craft3.com/web/index.php(21): yii\base\Application->run()
#11 {main}

I have double-checked my Stripe API keys and have both the test and live keys correctly entered. Any thoughts? Thanks!