Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe checkout is not working

We are use stripe payments method in a php script. We are getting the following error:

Fatal error: Uncaught exception 'Stripe\Error\InvalidRequest' with message 
    'Amount must be at least 50 cents' in /stripe-php/lib/ApiRequestor.php:102 
     from API request 'req_7w4X4j80cfWZoS'
Stack trace:
#0 /lib/ApiRequestor.php(216): 
       Stripe\ApiRequestor->handleApiError('{\n "error": {\n...', 400, Array, Array)
#1 /stripe-php/lib/ApiRequestor.php(60): 
       Stripe\ApiRequestor->_interpretResponse('{\n "error": {\n...', 400, Array)
#2 /stripe-php/lib/ApiResource.php(105): 
        Stripe\ApiRequestor->request('post', '/v1/charges', Array, Array)
#3 stripe-php/lib/ApiResource.php(137): 
         Stripe\ApiResource::_staticRequest('post', '/v1/charges', Array, NULL)
#4 /home/imarkinfo/donogifts.com/stripe-php/lib/Charge.php(37):
          Stripe\ApiResource::_create(Array, NULL)
#5 /form_section.php(81): 
          Stripe\Charge::create(Array)
#6 {main} thrown in stripe-php/lib/ApiRequestor.php on line 102

Please suggest how we can fix it

like image 350
Baljit Singh Avatar asked Feb 19 '16 12:02

Baljit Singh


Video Answer


2 Answers

You created the charge with amount=1. As the error message explicitly says, the minimum amount is 50 cents. All amounts in Stripe's API are in cents, so amount must be at least 50 when creating a charge.

like image 112
Ywain Avatar answered Nov 15 '22 17:11

Ywain


If you want to charge $1 you must set amount=100 as stripe uses cents.

like image 37
Alan Avatar answered Nov 15 '22 16:11

Alan