Cindy Turlington
Cindy Turlington

Reputation: 2527

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.

Upvotes: 3

Views: 1250

Answers (1)

iainn
iainn

Reputation: 17417

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.

Upvotes: 2

Related Questions