code: public static String urlEncodeId(String id) throws InvalidRequestException {
      try {
        return urlEncode(id);
      } catch (UnsupportedEncodingException e) {
        throw new InvalidRequestException(String.format(
            "Unable to encode `%s` in the url to %s. "
            + "Please contact support@stripe.com for assistance.", id, CHARSET),
            null, null, null, 0, e);
      }
    }
docs: URL-encode a string ID in url path formatting.