MarcinusX / flutter_stripe_demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`invalid_request_error` while calling https://api.stripe.com/v1/checkout/sessions

Abhishek01039 opened this issue · comments

This is what I am passing to my body

final body = {
      'payment_method_types': ['card'],
      'line_items': [
        {
          'price': 'price_1Ivaf4IicCqYtLEx7HJ1f67q',
          'quantity': 1,
        }
      ],
      'mode': 'payment',
      'success_url': 'http://localhost:8080/#/success',
      'cancel_url': 'http://localhost:8080/#/cancel',
    };

and I am getting this error

{
  "error": {
    "message": "Invalid request: unsupported Content-Type text/plain; charset=utf-8. If error persists and you need assistance, please contact support@stripe.com.",
    "type": "invalid_request_error"
  }
}

NOTE: web part is running fine.

Hello @MarcinusX
can you please tell me that what I am doing wrong here?
Thanks