Baljit Singh
Baljit Singh

Reputation: 147

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

Upvotes: 13

Views: 25346

Answers (3)

Faisal Mirza
Faisal Mirza

Reputation: 93

You need to charge the user in Cents. if your Amount is in USD, you can convert it to cents by Multiplying with 100. So if your amount is 5 USD. Convert it by $amount=5*100

Upvotes: 0

Alan
Alan

Reputation: 10145

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

Upvotes: 3

Ywain
Ywain

Reputation: 17503

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.

Upvotes: 45

Related Questions