Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stripe curl command line POST

I am trying to use stripe curl to charge a test customer 10 USD, but it returns error that the amount is incorrect.

    curl https://api.stripe.com/v1/charges      \

   -u sk_test_qtxx1EuLIMqMwOmEw3NKxxxx:     \

   -d amount=10.00                          \

   -d currency=usd                          \

   -d card[number]=4242424242424242         \

   -d card[exp_month]=12                    \

   -d card[exp_year]=2019                   \

   -d card[cvc]=123

The error returned was:

{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid integer: 10.00",
    "param": "amount"
  }
}

I tried 10, it said: "Amount must be at least 50 cents".

I wonder if I missed any post variables, like some kind of tokens or keys.

like image 591
Cindy Turlington Avatar asked Jul 23 '26 10:07

Cindy Turlington


1 Answers

As per the documentation, the amount parameter needs to be

A positive integer in the smallest currency unit

So for ten dollars, you need to pass 1000.

like image 102
iainn Avatar answered Jul 25 '26 00:07

iainn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!