#jimmy_97753

1 messages · Page 1 of 1 (latest)

spice pollenBOT
modest apex
#

If you visit the above link to see the request in your dashboard, you can see the problem. You're passing this single string in items: "price: 1344-CAD-3999-MONTH-1".

#

That shouldn't be a string. That really should be an object (key value pairs)

quiet ruin
#

have you ever done this in dart?
var response = await http.post(
Uri.parse('https://api.stripe.com/v1/subscriptions'),
headers: {
'Authorization':
'Bearer ...',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: {
'customer': widget.usagerGlobal.usagerStripe!.idstripe!,
'items': {
'price': '1344-CAD-3999-MONTH-1',
}.toString(),
},
);

modest apex
#

No I haven't

#

And we don't have an official client library for Dart, so there's a limited amount I can support

#

Main thing is to make sure your body is url form encoded

quiet ruin
#

just form-encoded or x-www-form-urlencoded

#

form-data*

modest apex
#

application/x-www-form-urlencoded is right

#

But as I haven't used dart before, I'm not sure if you're passing body the right way

quiet ruin
#

Perfect i will check that and do you know how to do it right with postman?

modest apex
#

I think you'd need to do like items[0][price]

#

But don't use postman regularly