Stripe Connect module API explorer

/api/user/connect/country-spec (GET)

Account information like email addresses is generated with faker-js it is not real user information.

await global.api.user.connect.CountrySpec.get(req)

Returns object

{
  "countryid": "US",
  "object": "countrySpec",
  "stripeObject": {
    "id": "US",
    "object": "country_spec",
    "default_currency": "usd",
    "supported_bank_account_currencies": {
      "usd": [
        "US"
      ]
    },
    "supported_payment_currencies": [
      "usd",
      "aed",
      "afn",
      "all",
      "amd",
      "ang",
      "aoa",
      "ars",
      "aud",
      "awg",
      "azn",
      "bam",
      "bbd",
      "bdt",
      "bgn",
      "bif",
      "bmd",
      "bnd",
      "bob",
      "brl",
      "bsd",
      "bwp",
      "byn",
      "bzd",
      "cad",
      "cdf",
      "chf",
      "clp",
      "cny",
      "cop",
      "crc",
      "cve",
      "czk",
      "djf",
      "dkk",
      "dop",
      "dzd",
      "egp",
      "etb",
      "eur",
      "fjd",
      "fkp",
      "gbp",
      "gel",
      "gip",
      "gmd",
      "gnf",
      "gtq",
      "gyd",
      "hkd",
      "hnl",
      "hrk",
      "htg",
      "huf",
      "idr",
      "ils",
      "inr",
      "isk",
      "jmd",
      "jpy",
      "kes",
      "kgs",
      "khr",
      "kmf",
      "krw",
      "kyd",
      "kzt",
      "lak",
      "lbp",
      "lkr",
      "lrd",
      "lsl",
      "mad",
      "mdl",
      "mga",
      "mkd",
      "mmk",
      "mnt",
      "mop",
      "mro",
      "mur",
      "mvr",
      "mwk",
      "mxn",
      "myr",
      "mzn",
      "nad",
      "ngn",
      "nio",
      "nok",
      "npr",
      "nzd",
      "pab",
      "pen",
      "pgk",
      "php",
      "pkr",
      "pln",
      "pyg",
      "qar",
      "ron",
      "rsd",
      "rub",
      "rwf",
      "sar",
      "sbd",
      "scr",
      "sek",
      "sgd",
      "shp",
      "sll",
      "sos",
      "srd",
      "std",
      "szl",
      "thb",
      "tjs",
      "top",
      "try",
      "ttd",
      "twd",
      "tzs",
      "uah",
      "ugx",
      "uyu",
      "uzs",
      "vnd",
      "vuv",
      "wst",
      "xaf",
      "xcd",
      "xof",
      "xpf",
      "yer",
      "zar",
      "zmw"
    ],
    "supported_payment_methods": [
      "card",
      "stripe"
    ],
    "supported_transfer_countries": [
      "US"
    ],
    "verification_fields": {
      "company": {
        "additional": [],
        "minimum": [
          "business_profile.mcc",
          "business_profile.url",
          "business_type",
          "company.address.city",
          "company.address.line1",
          "company.address.postal_code",
          "company.address.state",
          "company.name",
          "company.owners_provided",
          "company.phone",
          "company.tax_id",
          "external_account",
          "owners.address.city",
          "owners.address.line1",
          "owners.address.postal_code",
          "owners.address.state",
          "owners.dob.day",
          "owners.dob.month",
          "owners.dob.year",
          "owners.email",
          "owners.first_name",
          "owners.id_number",
          "owners.last_name",
          "owners.phone",
          "owners.ssn_last_4",
          "owners.verification.document",
          "representative.address.city",
          "representative.address.line1",
          "representative.address.postal_code",
          "representative.address.state",
          "representative.dob.day",
          "representative.dob.month",
          "representative.dob.year",
          "representative.email",
          "representative.first_name",
          "representative.id_number",
          "representative.last_name",
          "representative.phone",
          "representative.relationship.executive",
          "representative.relationship.title",
          "representative.ssn_last_4",
          "representative.verification.document",
          "tos_acceptance.date",
          "tos_acceptance.ip"
        ]
      },
      "individual": {
        "additional": [],
        "minimum": [
          "business_profile.mcc",
          "business_profile.url",
          "business_type",
          "external_account",
          "individual.address.city",
          "individual.address.line1",
          "individual.address.postal_code",
          "individual.address.state",
          "individual.dob.day",
          "individual.dob.month",
          "individual.dob.year",
          "individual.email",
          "individual.first_name",
          "individual.id_number",
          "individual.last_name",
          "individual.phone",
          "individual.ssn_last_4",
          "individual.verification.document",
          "tos_acceptance.date",
          "tos_acceptance.ip"
        ]
      }
    },
    "name": "United States"
  },
  "createdAt": "2022-06-24T12:01:01.579Z",
  "updatedAt": "2022-06-24T12:01:01.579Z"
}

Exceptions

These exceptions are thrown (NodeJS) or returned as JSON (HTTP) if you provide incorrect data or do not meet the requirements:

Exception Circumstances
undefined missing querystring countryid
invalid querystring countryid

NodeJS source (view on github)

const connect = require('../../../../../index.js')

module.exports = {
  get: async (req) => {
    if (!req.query || !req.query.countryid) {
      throw new Error('invalid-countryid')
    }
    const countryInfo = await connect.Storage.CountrySpec.findOne({
      where: {
        countryid: req.query.countryid
      }
    })
    if (!countryInfo) {
      throw new Error('invalid-countryid')
    }
    const country = {}
    for (const field of countryInfo._options.attributes) {
      country[field] = countryInfo.get(field)
    }
    return country
  }
}

Test source (view on github)

/* eslint-env mocha */
const assert = require('assert')
const TestHelper = require('../../../../../test-helper.js')

describe('/api/user/connect/country-spec', function () {
  before(TestHelper.disableMetrics)
  after(TestHelper.enableMetrics)
  describe('exceptions', () => {
    it('missing querystring countryid', async () => {
      const user = await TestHelper.createUser()
      const req = TestHelper.createRequest('/api/user/connect/country-spec')
      req.account = user.account
      req.session = user.session
      let errorMessage
      try {
        await req.get()
      } catch (error) {
        errorMessage = error.message
      }
      assert.strictEqual(errorMessage, 'invalid-countryid')
    })

    it('invalid querystring countryid', async () => {
      const user = await TestHelper.createUser()
      const req = TestHelper.createRequest('/api/user/connect/country-spec?countryid=invalid')
      req.account = user.account
      req.session = user.session
      let errorMessage
      try {
        await req.get()
      } catch (error) {
        errorMessage = error.message
      }
      assert.strictEqual(errorMessage, 'invalid-countryid')
    })
  })

  describe('returns', () => {
    it('object', async () => {
      const user = await TestHelper.createUser()
      const req = TestHelper.createRequest('/api/user/connect/country-spec?countryid=US')
      req.account = user.account
      req.session = user.session
      req.filename = __filename
      req.saveResponse = true
      const countrySpec = await req.get()
      assert.strictEqual(countrySpec.countryid, 'US')
    })
  })
})