字符串列表在 POST REST api Dart/Flutter 中转换为单个字符串 [英] List of Strings converts to single String in POST REST api Dart/Flutter

查看:50
本文介绍了字符串列表在 POST REST api Dart/Flutter 中转换为单个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发布了一个相关问题

任何帮助将不胜感激我现在被困了 3 天.

解决方案

解决方案!

代码更改:

'payment_method_types[]' : ['card']

我不知道为什么它会这样工作,但确实如此!

I have posted a related question here which is in specific to what I'm doing.

Here is the problem, I'm passing List of String to POST for Stripe API. But on Stripe dashboard its getting it as a single String

payment_method_types

 final body = {
      'payment_method_types': [
        'card',
      ],
      'line_items': [
        {
          'amount': price,
          'quantity': 1,
          'currency': 'usd',
          'name': 'Some Name here'
        },
      ],
      'mode': 'payment',
      'success_url': 'https://success.com/{CHECKOUT_SESSION_ID}',
      'cancel_url': 'https://cancel.com/',
    };

And this is the response on the logs at Stripe dashboard:

Any help will be appreciated I'm stuck for 3 days now.

解决方案

Solution!

Change in code:


'payment_method_types[]' : ['card']

I have no reason why it worked this way but it did!

这篇关于字符串列表在 POST REST api Dart/Flutter 中转换为单个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆