We are use stripe payments
method in a php script. We are getting the following error:
Fatal error: Uncaught exception 'StripeErrorInvalidRequest' 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): StripeApiRequestor->handleApiError('{n "error": {n...', 400, Array, Array) #1 /stripe-php/lib/ApiRequestor.php(60): StripeApiRequestor->_interpretResponse('{n "error": {n...', 400, Array) #2 /stripe-php/lib/ApiResource.php(105): StripeApiRequestor->request('post', '/v1/charges', Array, Array) #3 stripe-php/lib/ApiResource.php(137): StripeApiResource::_staticRequest('post', '/v1/charges', Array, NULL) #4 /home/imarkinfo/donogifts.com/stripe-php/lib/Charge.php(37): StripeApiResource::_create(Array, NULL) #5 /form_section.php(81): StripeCharge::create(Array) #6 {main} thrown in stripe-php/lib/ApiRequestor.php on line 102
Please suggest how we can fix it
Advertisement
Answer
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.